public void Importing_same_object_twice_should_not_throw(JsonConfigurationSerializer sut, ObjectWithComplexArray testSource, string rootSectionName) { _ = sut.Serialize(testSource, rootSectionName); var result = sut.Serialize(testSource, rootSectionName); Assert.That(result, Contains.Key($"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Text)}")); Assert.That(result, Contains.Key($"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Value)}")); Assert.That(result[$"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Text)}"], Is.EqualTo($"{testSource.Items[0].Text}")); Assert.That(result[$"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Value)}"], Is.EqualTo($"{testSource.Items[0].Value}")); }
public void Object_with_array_is_correctly_serialized(JsonConfigurationSerializer sut, ObjectWithComplexArray testSource, string rootSectionName) { var result = sut.Serialize(testSource, rootSectionName); Assert.That(result, Contains.Key($"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Text)}")); Assert.That(result, Contains.Key($"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Value)}")); Assert.That(result[$"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Text)}"], Is.EqualTo($"{testSource.Items[0].Text}")); Assert.That(result[$"{rootSectionName}:{nameof(testSource.Items)}:0:{nameof(ObjectWithSimpleProperties.Value)}"], Is.EqualTo($"{testSource.Items[0].Value}")); }