-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
RegistryKey_GetValueCount.cs
46 lines (39 loc) · 1.31 KB
/
RegistryKey_GetValueCount.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
36
37
38
39
40
41
42
43
44
45
46
// 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 class RegistryKey_GetValueCount : RegistryTestsBase
{
[Fact]
public void NegativeTests()
{
Assert.Throws<ObjectDisposedException>(() =>
{
TestRegistryKey.Dispose();
return TestRegistryKey.ValueCount;
});
}
[Fact]
public void TestValueCount()
{
Assert.Equal(expected: 0, actual: TestRegistryKey.ValueCount);
TestRegistryKey.SetValue(TestRegistryKeyName, 5);
Assert.Equal(expected: 1, actual: TestRegistryKey.ValueCount);
TestRegistryKey.DeleteValue(TestRegistryKeyName);
Assert.Equal(expected: 0, actual: TestRegistryKey.ValueCount);
}
[Fact]
public void TestValueCount2()
{
int expectedCount = 0;
foreach (var testCase in TestData.TestValueTypes)
{
TestRegistryKey.SetValue(testCase[0].ToString(), testCase[1]);
++expectedCount;
}
Assert.Equal(expectedCount, TestRegistryKey.ValueCount);
}
}
}