Ejemplo n.º 1
0
        public void Be_Creatable()
        {
            var sut = new XceedDoubleField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);

            sut.Should().NotBeNull();
            sut.Should().BeAssignableTo <INZazuWpfField>();
        }
Ejemplo n.º 2
0
        public void Use_DoubleUpdown()
        {
            var sut = new XceedDoubleField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);

            sut.ContentProperty.Should().Be(DoubleUpDown.ValueProperty);

            var control = (DoubleUpDown)sut.ValueControl;

            control.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public void Format_ControlValue_From_StringValue()
        {
            var sut = new XceedDoubleField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);
            var control = (DoubleUpDown)sut.ValueControl;

            sut.GetValue().Should().BeNullOrEmpty();
            control.Value.Should().NotHaveValue();

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

            sut.SetValue(string.Empty);
            control.Value.Should().NotHaveValue();
        }
Ejemplo n.º 4
0
        public void Format_StringValue_From_ControlValue()
        {
            var sut = new XceedDoubleField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);
            var control = (DoubleUpDown)sut.ValueControl;

            control.Value = 1.4;
            sut.GetValue().Should().Be("1.4");

            control.Value = null;
            sut.IsValid().Should().BeTrue();
            sut.GetValue().Should().Be("");

            control.Text = null;
            sut.IsValid().Should().BeTrue();
            sut.GetValue().Should().Be(string.Empty);
        }
Ejemplo n.º 5
0
        public void Not_Set_null_format_string()
        {
            var sut = new XceedDoubleField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);

            sut.Definition.Settings.Add("Format", null);

            var control = (DoubleUpDown)sut.ValueControl;

            control.FormatString.Should().NotBeNull();

            const string format = "#.00";

            sut = new XceedDoubleField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);
            sut.Definition.Settings.Add("Format", format);

            control = (DoubleUpDown)sut.ValueControl;
            control.FormatString.Should().Be(format);
        }