public void Serialize_And_Deserialize_Null_Rows_To_Null() { var serializer = new NZazuTableDataXmlSerializer(); var data = new Dictionary <string, string> { { "table01_field01__1", null }, { "table01_field01__2", null } }; var dataSerialized = serializer.Serialize(data); // ReSharper disable once UseObjectOrCollectionInitializer var sut = new NZazuDataTableField(new FieldDefinition { Key = "table01", Fields = new[] { new FieldDefinition { Key = "table01_field01", Type = "string" } } }, ServiceLocator); sut.SetValue(dataSerialized); // test the returned data var actual = serializer.Deserialize(sut.GetValue()); actual.Count.Should().Be(0); sut.Validate().IsValid.Should().BeTrue(); ((DynamicDataTable)sut.ValueControl).LayoutGrid.RowDefinitions.Count.Should().Be(2); }
public void Deserialize_Empty_Data(string data) { object Fct(Type t) { if (t == typeof(INZazuTableDataSerializer)) { return(new NZazuTableDataXmlSerializer()); } if (t == typeof(INZazuWpfFieldFactory)) { return(new NZazuFieldFactory()); } return(null); } // ReSharper disable once UseObjectOrCollectionInitializer var sut = new NZazuDataTableField(new FieldDefinition { Key = "table01", Fields = new[] { new FieldDefinition { Key = "table01_field01", Type = "string" } } }, ServiceLocator); sut.SetValue(data); var actual = ((INZazuTableDataSerializer)Fct(typeof(INZazuTableDataSerializer))).Deserialize(sut.GetValue()); actual.Should().NotBeNull(); ((DynamicDataTable)sut.ValueControl).LayoutGrid.RowDefinitions.Count.Should().Be(2); }