aboutsummaryrefslogtreecommitdiff
path: root/src/test/burn/WixTestTools/ArpEntryInstaller.cs
blob: cc049ec71f2d41dd68459c53be1668c773cb6473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 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.

namespace WixTestTools
{
    using System;
    using Xunit;

    public partial class ArpEntryInstaller : IDisposable
    {
        public ArpEntryInstaller(WixTestContext testContext, string id, bool perMachine = true, bool x64 = false)
        {
            this.ArpId = id;
            this.PerMachine = perMachine;
            this.X64 = x64;
            this.TestContext = testContext;
        }

        public string ArpId { get; }

        public bool PerMachine { get; }

        public bool X64 { get; }

        private WixTestContext TestContext { get; }

        public void Unregister(bool assertIfMissing = true)
        {
            if (this.TryGetRegistration(out var registration))
            {
                registration.Delete();
            }
            else
            {
                Assert.Fail("Tried to unregister when not registered.");
            }
        }

        public void Dispose()
        {
            this.Unregister(false);
        }
    }
}