@@ -47,37 +47,28 @@ public static void Cleanup()
47
47
}
48
48
49
49
[ TestMethod ]
50
- public void Constructor_FileDoesNotExist_WhenInitialized_CreateNewFile ( )
50
+ public void Constructor_FileDoesNotExist ( )
51
51
{
52
52
if ( File . Exists ( TestFilePath ) )
53
53
{
54
54
File . Delete ( TestFilePath ) ;
55
55
}
56
56
57
- _ = new TestSettings ( TestFilePath ) ;
57
+ var settings = new TestSettings ( TestFilePath ) ;
58
58
59
- Assert . IsTrue ( File . Exists ( TestFilePath ) ) ;
59
+ // verify settings does not throw, does not have a well-known value
60
+ Assert . IsFalse ( settings . TryGetValue ( Constants . HttpsProxy , out _ ) ) ;
60
61
}
61
62
62
63
[ TestMethod ]
63
- public void Constructor_FileExistsButEmpty_WhenInitialized_PopulateFile ( )
64
+ public void Constructor_FileExistsButEmpty ( )
64
65
{
65
66
File . WriteAllText ( TestFilePath , "" ) ;
66
67
67
- _ = new TestSettings ( TestFilePath ) ;
68
+ var settings = new TestSettings ( TestFilePath ) ;
68
69
69
- Assert . IsTrue ( new FileInfo ( TestFilePath ) . Length > 0 ) ;
70
- }
71
-
72
- [ TestMethod ]
73
- public void Constructor_FileExistsAndIsValid_WhenInitialized_DoNotModify ( )
74
- {
75
- string fileText = @"{ ""foo"": {} }" ;
76
- File . WriteAllText ( TestFilePath , fileText ) ;
77
-
78
- _ = new TestSettings ( TestFilePath ) ;
79
-
80
- Assert . AreEqual ( fileText , File . ReadAllText ( TestFilePath ) ) ;
70
+ // verify settings does not throw, does not have a well-known value
71
+ Assert . IsFalse ( settings . TryGetValue ( Constants . HttpsProxy , out _ ) ) ;
81
72
}
82
73
83
74
[ TestMethod ]
@@ -86,14 +77,10 @@ public void Constructor_FileExistsButNotJsonObject_Initialize()
86
77
string fileText = @"[]" ; // valid JSON, but not an object
87
78
File . WriteAllText ( TestFilePath , fileText ) ;
88
79
89
- _ = new TestSettings ( TestFilePath ) ;
90
-
91
- string actual = File . ReadAllText ( TestFilePath ) ;
92
- string expected = @"{
93
- ""config"": {}
94
- }" ;
80
+ var settings = new TestSettings ( TestFilePath ) ;
95
81
96
- Assert . AreEqual ( StringUtility . NormalizeNewLines ( expected ) , StringUtility . NormalizeNewLines ( actual ) ) ;
82
+ // verify settings does not throw, does not have a well-known value
83
+ Assert . IsFalse ( settings . TryGetValue ( Constants . HttpsProxy , out _ ) ) ;
97
84
}
98
85
99
86
[ TestMethod ]
@@ -121,19 +108,7 @@ public void TryGetValue_ValueDoesNotExist_ReturnFalseWithEmptyString()
121
108
}
122
109
123
110
[ TestMethod ]
124
- public void TryGetValue_ValueExists_ReturnTrueWithValue ( )
125
- {
126
- string fileText = @"{ ""config"": { ""testKey"": ""testValue"" } }" ;
127
- File . WriteAllText ( TestFilePath , fileText ) ;
128
-
129
- bool success = new TestSettings ( TestFilePath ) . TryGetValue ( "testKey" , out string value ) ;
130
-
131
- Assert . IsTrue ( success ) ;
132
- Assert . AreEqual ( "testValue" , value ) ;
133
- }
134
-
135
- [ TestMethod ]
136
- public void TryGetValue_ValueExistsInDifferentCase_ReturnFalse ( )
111
+ public void TryGetValue_SettingsNameIsCaseSensitive ( )
137
112
{
138
113
string fileText = @"{ ""config"": { ""testKey"": ""testValue"" } }" ;
139
114
File . WriteAllText ( TestFilePath , fileText ) ;
@@ -212,7 +187,7 @@ public void SetValue_ValueExists_UpdateValue()
212
187
}
213
188
214
189
[ TestMethod ]
215
- public void SetEncyptedValue_ValueIsDifferentFromOriginal ( )
190
+ public void SetEncryptedValue_ValueIsDifferentFromOriginal ( )
216
191
{
217
192
var ut = new TestSettings ( TestFilePath ) ;
218
193
0 commit comments