-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
RegistryKeyDeleteSubKeyTestsBase.cs
35 lines (28 loc) · 1.15 KB
/
RegistryKeyDeleteSubKeyTestsBase.cs
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Xunit;
namespace Microsoft.Win32.RegistryTests
{
public abstract class RegistryKeyDeleteSubKeyTestsBase : RegistryTestsBase
{
protected void Verify_DeleteSubKey_KeyExists_KeyDeleted(string expected, Action deleteSubKey)
{
CreateTestRegistrySubKey(expected);
deleteSubKey();
Assert.Null(TestRegistryKey.OpenSubKey(expected));
}
protected void Verify_DeleteSubKey_KeyDoesNotExists_Throws(string expected, Action deleteSubKey)
{
Assert.Null(TestRegistryKey.OpenSubKey(expected));
Assert.Equal(0, TestRegistryKey.SubKeyCount);
AssertExtensions.Throws<ArgumentException>(null, () => deleteSubKey());
}
protected void Verify_DeleteSubKey_KeyDoesNotExists_DoesNotThrow(string expected, Action deleteSubKey)
{
Assert.Null(TestRegistryKey.OpenSubKey(expected));
Assert.Equal(0, TestRegistryKey.SubKeyCount);
deleteSubKey();
}
}
}