Debian Codegraph @

external/corefx/src/Microsoft.Win32.Registry/tests/RegistryKey/RegistryKeyDeleteSubKeyTreeTestsBase.cs

raw
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4
5 using System;
6 using Xunit;
7
8 namespace Microsoft.Win32.RegistryTests
9 {
10 public abstract class RegistryKeyDeleteSubKeyTreeTestsBase : RegistryTestsBase
11 {
12 protected void Verify_DeleteSubKeyTree_KeyExists_KeyDeleted(string expected, Action deleteSubKeyTree)
13 {
14 CreateTestRegistrySubKey(expected);
15
16 deleteSubKeyTree();
17 Assert.Null(TestRegistryKey.OpenSubKey(expected));
18 }
19
20 protected void Verify_DeleteSubKeyTree_KeyDoesNotExists_Throws(string expected, Action deleteSubKeyTree)
21 {
22 Assert.Null(TestRegistryKey.OpenSubKey(expected));
23 Assert.Equal(0, TestRegistryKey.SubKeyCount);
24
25 AssertExtensions.Throws<ArgumentException>(null, () => deleteSubKeyTree());
26 }
27
28 protected void Verify_DeleteSubKeyTree_KeyDoesNotExists_DoesNotThrow(string expected, Action deleteSubKeyTree)
29 {
30 Assert.Null(TestRegistryKey.OpenSubKey(expected));
31 Assert.Equal(0, TestRegistryKey.SubKeyCount);
32
33 deleteSubKeyTree();
34 }
35 }
36 }