Skip to content

Commit 7aae9bc

Browse files
committed
Updated tests which expected SetValue(key, null) to maintain record
Previously, calling `SetValue(key, null)` would set the `TrackedRecord<T>.Value` to null, but wouldn't delete the record. This was confusing, if not buggy, and the behavior was fixed (3d1ad6b, 0bccf1f). In doing so, however, unit tests which validated the previous assumption broke, and needed to be updated. This isn't expected to harm any actual implementations, as they should already be written to account for missing records, since this is the default when loading from the database. The null value scenario would only occur when updating previously saved values.
1 parent 326e64c commit 7aae9bc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

OnTopic.Tests/TopicReferenceCollectionTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public void SetValue_ExistingReference_TopicUpdated() {
220220
/// TrackedRecordCollection{TItem, TValue, TAttribute}.SetValue(String, TValue, Boolean?, DateTime?)"/>, updates the
221221
/// reference using <see cref="TrackedRecordCollection{TItem, TValue, TAttribute}.SetValue(String, TValue, Boolean?,
222222
/// DateTime?)"/> with a <c>null</c> value, and confirms that the <see cref="Topic"/> reference and <see cref="Topic.
223-
/// IncomingRelationships"/> are correctly updated.
223+
/// IncomingRelationships"/> are correctly removed.
224224
/// </summary>
225225
/// <remarks>
226226
/// This calls <see cref="TrackedRecordCollection{TItem, TValue, TAttribute}.SetValue(String, TValue, Boolean?, DateTime?)
@@ -238,7 +238,7 @@ public void SetValue_ExistingReference_IncomingRelationshipsUpdates() {
238238
topic.References.SetValue("Reference", null);
239239
topic.References.SetValue("Reference", null);
240240

241-
Assert.True(topic.References.Contains("Reference"));
241+
Assert.False(topic.References.Contains("Reference"));
242242
Assert.Null(topic.References.GetValue("Reference"));
243243
Assert.Equal<int?>(0, reference.IncomingRelationships.GetValues("Reference")?.Count);
244244

@@ -262,7 +262,7 @@ public void SetValue_NullReference_TopicRemoved() {
262262
topic.References.SetValue("Reference", reference);
263263
topic.References.SetValue("Reference", null);
264264

265-
Assert.Single(topic.References);
265+
Assert.Empty(topic.References);
266266
Assert.Null(topic.References.GetValue("Reference"));
267267

268268
}

0 commit comments

Comments
 (0)