@@ -61,7 +61,7 @@ public void Setup()
61
61
}
62
62
63
63
/// <summary>
64
- /// Calls `get` on the `user-settings` resource.
64
+ /// Calls `get` on the `user-settings-file ` resource.
65
65
/// </summary>
66
66
[ Test ]
67
67
public void UserSettingsFile_Get ( )
@@ -70,12 +70,12 @@ public void UserSettingsFile_Get()
70
70
var getOutput = Get ( new ( ) ) ;
71
71
72
72
Assert . IsNotNull ( getOutput ) ;
73
- Assert . AreEqual ( ActionPropertyValueFull , getOutput . Action ) ;
73
+ Assert . IsNull ( getOutput . Action ) ;
74
74
AssertSettingsAreEqual ( expected , getOutput . Settings ) ;
75
75
}
76
76
77
77
/// <summary>
78
- /// Calls `set` on the `user-settings` resource with no diff.
78
+ /// Calls `set` on the `user-settings-file ` resource with no diff.
79
79
/// </summary>
80
80
/// <param name="action">The action value.</param>
81
81
[ Test ]
@@ -90,13 +90,13 @@ public void UserSettingsFile_Set_NoDiff(string action)
90
90
var expected = GetCurrentUserSettings ( ) ;
91
91
92
92
Assert . IsNotNull ( setOutput ) ;
93
- Assert . AreEqual ( ActionPropertyValueFull , setOutput . Action ) ;
93
+ Assert . AreEqual ( action , setOutput . Action ) ;
94
94
AssertSettingsAreEqual ( expected , setOutput . Settings ) ;
95
95
AssertDiffState ( setDiff , [ ] ) ;
96
96
}
97
97
98
98
/// <summary>
99
- /// Calls `set` on the `user-settings` resource to add fields.
99
+ /// Calls `set` on the `user-settings-file ` resource to add fields.
100
100
/// </summary>
101
101
/// <param name="action">The action value.</param>
102
102
[ Test ]
@@ -114,14 +114,37 @@ public void UserSettingsFile_Set_AddFields(string action)
114
114
115
115
// Assert that the settings are added
116
116
Assert . IsNotNull ( setOutput ) ;
117
- Assert . AreEqual ( ActionPropertyValueFull , setOutput . Action ) ;
117
+ Assert . AreEqual ( action , setOutput . Action ) ;
118
118
AssertMockProperties ( setOutput . Settings , "mock" ) ;
119
119
AssertSettingsAreEqual ( expected , setOutput . Settings ) ;
120
120
AssertDiffState ( setDiff , [ SettingsPropertyName ] ) ;
121
121
}
122
122
123
123
/// <summary>
124
- /// Calls `set` on the `user-settings` resource to update fields.
124
+ /// Calls `set` on the `user-settings-file` resource to ensure action is partial by default.
125
+ /// </summary>
126
+ [ Test ]
127
+ public void UserSettingsFile_Set_ActionIsPartialByDefault ( )
128
+ {
129
+ // Call `set` to add mock properties to the settings
130
+ var setSettings = GetSettingsArg ( ActionPropertyValuePartial ) ;
131
+ AddOrModifyMockProperties ( setSettings , "mock" ) ;
132
+
133
+ var expected = GetCurrentUserSettings ( ) ;
134
+ AddOrModifyMockProperties ( expected , "mock" ) ;
135
+
136
+ ( var setOutput , var setDiff ) = Set ( new ( ) { Settings = setSettings } ) ;
137
+
138
+ // Assert that the settings are added
139
+ Assert . IsNotNull ( setOutput ) ;
140
+ Assert . AreEqual ( setOutput . Action , ActionPropertyValuePartial ) ;
141
+ AssertMockProperties ( setOutput . Settings , "mock" ) ;
142
+ AssertSettingsAreEqual ( expected , setOutput . Settings ) ;
143
+ AssertDiffState ( setDiff , [ SettingsPropertyName ] ) ;
144
+ }
145
+
146
+ /// <summary>
147
+ /// Calls `set` on the `user-settings-file` resource to update fields.
125
148
/// </summary>
126
149
/// <param name="action">The action value.</param>
127
150
[ Test ]
@@ -144,14 +167,14 @@ public void UserSettingsFile_Set_UpdateFields(string action)
144
167
145
168
// Assert that the settings are updated
146
169
Assert . IsNotNull ( setOutput ) ;
147
- Assert . AreEqual ( ActionPropertyValueFull , setOutput . Action ) ;
170
+ Assert . AreEqual ( action , setOutput . Action ) ;
148
171
AssertMockProperties ( setOutput . Settings , "mock_new" ) ;
149
172
AssertSettingsAreEqual ( expected , setOutput . Settings ) ;
150
173
AssertDiffState ( setDiff , [ SettingsPropertyName ] ) ;
151
174
}
152
175
153
176
/// <summary>
154
- /// Calls `test` on the `user-settings` resource to check if the settings are in desired state.
177
+ /// Calls `test` on the `user-settings-file ` resource to check if the settings are in desired state.
155
178
/// </summary>
156
179
/// <param name="action">The action value.</param>
157
180
[ Test ]
@@ -174,15 +197,15 @@ public void UserSettingsFile_Test_InDesiredState(string action)
174
197
175
198
// Assert that the settings are in desired state
176
199
Assert . IsNotNull ( testOutput ) ;
177
- Assert . AreEqual ( ActionPropertyValueFull , testOutput . Action ) ;
200
+ Assert . AreEqual ( action , testOutput . Action ) ;
178
201
AssertMockProperties ( testOutput . Settings , "mock" ) ;
179
202
AssertSettingsAreEqual ( expected , testOutput . Settings ) ;
180
203
Assert . IsTrue ( testOutput . InDesiredState ) ;
181
204
AssertDiffState ( testDiff , [ ] ) ;
182
205
}
183
206
184
207
/// <summary>
185
- /// Calls `test` on the `user-settings` resource to check if the settings are not in desired state.
208
+ /// Calls `test` on the `user-settings-file ` resource to check if the settings are not in desired state.
186
209
/// </summary>
187
210
/// <param name="action">The action value.</param>
188
211
[ Test ]
@@ -205,15 +228,15 @@ public void UserSettingsFile_Test_NotInDesiredState(string action)
205
228
206
229
// Assert that the settings are not in desired state
207
230
Assert . IsNotNull ( testOutput ) ;
208
- Assert . AreEqual ( ActionPropertyValueFull , testOutput . Action ) ;
231
+ Assert . AreEqual ( action , testOutput . Action ) ;
209
232
AssertMockProperties ( testOutput . Settings , "mock_set" ) ;
210
233
AssertSettingsAreEqual ( expected , testOutput . Settings ) ;
211
234
Assert . IsFalse ( testOutput . InDesiredState ) ;
212
235
AssertDiffState ( testDiff , [ SettingsPropertyName ] ) ;
213
236
}
214
237
215
238
/// <summary>
216
- /// Calls `export` on the `user-settings` resource to export the settings.
239
+ /// Calls `export` on the `user-settings-file ` resource to export the settings.
217
240
/// </summary>
218
241
[ Test ]
219
242
public void UserSettingsFile_Export ( )
@@ -222,12 +245,12 @@ public void UserSettingsFile_Export()
222
245
var exportOutput = Export ( new ( ) ) ;
223
246
224
247
Assert . IsNotNull ( exportOutput ) ;
225
- Assert . AreEqual ( ActionPropertyValueFull , exportOutput . Action ) ;
248
+ Assert . IsNull ( exportOutput . Action ) ;
226
249
AssertSettingsAreEqual ( expected , exportOutput . Settings ) ;
227
250
}
228
251
229
252
/// <summary>
230
- /// Calls `get` on the `user-settings` resource.
253
+ /// Calls `get` on the `user-settings-file ` resource.
231
254
/// </summary>
232
255
/// <param name="resourceData">The input resource data.</param>
233
256
/// <returns>The output resource data.</returns>
@@ -239,7 +262,7 @@ private static UserSettingsFileResourceData Get(UserSettingsFileResourceData res
239
262
}
240
263
241
264
/// <summary>
242
- /// Calls `set` on the `user-settings` resource.
265
+ /// Calls `set` on the `user-settings-file ` resource.
243
266
/// </summary>
244
267
/// <param name="resourceData">The input resource data.</param>
245
268
/// <returns>The output resource data and the diff.</returns>
@@ -251,7 +274,7 @@ private static (UserSettingsFileResourceData, List<string>) Set(UserSettingsFile
251
274
}
252
275
253
276
/// <summary>
254
- /// Calls `test` on the `user-settings` resource.
277
+ /// Calls `test` on the `user-settings-file ` resource.
255
278
/// </summary>
256
279
/// <param name="resourceData">The input resource data.</param>
257
280
/// <returns>The output resource data and the diff.</returns>
@@ -263,7 +286,7 @@ private static (UserSettingsFileResourceData, List<string>) Test(UserSettingsFil
263
286
}
264
287
265
288
/// <summary>
266
- /// Calls `export` on the `user-settings` resource.
289
+ /// Calls `export` on the `user-settings-file ` resource.
267
290
/// </summary>
268
291
/// <param name="resourceData">The input resource data.</param>
269
292
/// <returns>The output resource data.</returns>
@@ -333,6 +356,7 @@ private class UserSettingsFileResourceData
333
356
[ JsonPropertyName ( InDesiredStatePropertyName ) ]
334
357
public bool ? InDesiredState { get ; set ; }
335
358
359
+ [ JsonIgnore ( Condition = JsonIgnoreCondition . WhenWritingDefault ) ]
336
360
public string Action { get ; set ; }
337
361
338
362
public JsonObject Settings { get ; set ; }
0 commit comments