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 Validate() { var s = new NZazuTableDataXmlSerializer(); var data = new Dictionary <string, string> { { "table01_field01__1", "" }, { "table01_field01__2", "world" } }; var dataSerialized = s.Serialize(data); // ReSharper disable once UseObjectOrCollectionInitializer var sut = new NZazuDataTableField(new FieldDefinition { Key = "table01", Fields = new[] { new FieldDefinition { Key = "table01_field01", Type = "string", Checks = new[] { new CheckDefinition { Type = "required" } } } } }, ServiceLocator); // ReSharper disable once UnusedVariable var justToMakeTheCall = sut.ValueControl; sut.SetValue(dataSerialized); sut.Validate().IsValid.Should().BeFalse(); // now change the data data = new Dictionary <string, string> { { "table01_field01__1", "hello" }, { "table01_field01__2", "world" } }; dataSerialized = s.Serialize(data); sut.SetValue(dataSerialized); sut.Validate().IsValid.Should().BeTrue(); }