public void Object_is_correctly_serialized(JsonConfigurationSerializer sut, ObjectWithSimpleProperties testSource, string rootSectionName) { var result = sut.Serialize(testSource, rootSectionName); Assert.That(result, Contains.Key($"{rootSectionName}:{nameof(testSource.Text)}")); Assert.That(result, Contains.Key($"{rootSectionName}:{nameof(testSource.Value)}")); Assert.That(result[$"{rootSectionName}:{nameof(testSource.Text)}"], Is.EqualTo(testSource.Text)); Assert.That(result[$"{rootSectionName}:{nameof(testSource.Value)}"], Is.EqualTo($"{testSource.Value}")); }
public void Null_values_should_not_be_added(JsonConfigurationSerializer sut, ObjectWithSimpleProperties testSource, string rootSectionName) { testSource.Text = null; var result = sut.Serialize(testSource, rootSectionName); Assert.That(result, Does.Not.ContainKey($"{rootSectionName}:{nameof(testSource.Text)}")); Assert.That(result, Contains.Key($"{rootSectionName}:{nameof(testSource.Value)}")); Assert.That(result[$"{rootSectionName}:{nameof(testSource.Value)}"], Is.EqualTo($"{testSource.Value}")); }