| 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 class RegistryKey_Close : RegistryTestsBase |
| 11 |
{ |
| 12 |
[Fact] |
| 13 |
public void CloseRegistryKeyTest() |
| 14 |
{ |
| 15 |
TestRegistryKey.Close(); |
| 16 |
|
| 17 |
// Should throw if RegistryKey is closed |
| 18 |
Assert.Throws<ObjectDisposedException>(() => TestRegistryKey.DeleteSubKey(TestRegistryKeyName)); |
| 19 |
Assert.Throws<ObjectDisposedException>(() => TestRegistryKey.CreateSubKey(TestRegistryKeyName)); |
| 20 |
Assert.Throws<ObjectDisposedException>(() => TestRegistryKey.SetValue(string.Empty, "String")); |
| 21 |
} |
| 22 |
} |
| 23 |
} |