コード例 #1
0
        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);
        }
コード例 #2
0
        public void Format_TextBox_From_StringValue()
        {
            var sut = new NZazuDoubleField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);
            var control = (TextBox)sut.ValueControl;

            sut.GetValue().Should().BeNullOrEmpty();
            control.Text.Should().BeEmpty();

            sut.SetValue("1.4");
            control.Text.Should().Be("1.4");

            sut.SetValue("");
            control.Text.Should().BeEmpty();
        }