public void Format_StringValue_From_TextBox() { var sut = new NZazuDoubleField(new FieldDefinition { Key = "key" }, ServiceLocator); var control = (TextBox)sut.ValueControl; control.Text = "1.4"; sut.GetValue().Should().Be("1.4"); control.Text = string.Empty; sut.IsValid().Should().BeTrue(); sut.GetValue().Should().Be(""); // ReSharper disable once AssignNullToNotNullAttribute control.Text = null; sut.IsValid().Should().BeTrue(); sut.GetValue().Should().Be(string.Empty); }
public void Format_Value_From_TextBox() { var sut = new NZazuDoubleField(new FieldDefinition { Key = "key" }, ServiceLocator); var control = (TextBox)sut.ValueControl; sut.Value.Should().NotHaveValue(); control.Text.Should().BeEmpty(); control.Text = "1."; sut.Value.Should().BeApproximately(1.0, double.Epsilon); control.Text.Should().Be("1."); // ReSharper disable once AssignNullToNotNullAttribute control.Text = null; sut.IsValid().Should().BeTrue(); sut.Value.Should().NotHaveValue(); }