| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixTestTools |
| 4 | { |
| 5 | using System; |
| 6 | using Xunit; |
| 7 | |
| 8 | public partial class ArpEntryInstaller : IDisposable |
| 9 | { |
| 10 | public ArpEntryInstaller(WixTestContext testContext, string id, bool perMachine = true, bool x64 = false) |
| 11 | { |
| 12 | this.ArpId = id; |
| 13 | this.PerMachine = perMachine; |
| 14 | this.X64 = x64; |
| 15 | this.TestContext = testContext; |
| 16 | } |
| 17 | |
| 18 | public string ArpId { get; } |
| 19 | |
| 20 | public bool PerMachine { get; } |
| 21 | |
| 22 | public bool X64 { get; } |
| 23 | |
| 24 | private WixTestContext TestContext { get; } |
| 25 | |
| 26 | public void Unregister(bool assertIfMissing = true) |
| 27 | { |
| 28 | if (this.TryGetRegistration(out var registration)) |
| 29 | { |
| 30 | registration.Delete(); |
| 31 | } |
| 32 | else |
| 33 | { |
| 34 | Assert.Fail("Tried to unregister when not registered."); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | public void Dispose() |
| 39 | { |
| 40 | this.Unregister(false); |
| 41 | } |
| 42 | } |
| 43 | } |