Ejemplo n.º 1
0
        public void Format_StringValue_From_TextBox()
        {
            var sut = new NZazuDateField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);
            var datePicker = (DatePicker)sut.ValueControl;

            var now = DateTime.Now.Date;

            datePicker.SelectedDate = now;
            sut.GetValue().Should().Be(now.ToString(CultureInfo.InvariantCulture));

            datePicker.SelectedDate = null;
            sut.IsValid().Should().BeTrue();
            sut.GetValue().Should().Be("");

            datePicker.Text = null;
            sut.IsValid().Should().BeTrue();
            sut.GetValue().Should().Be(string.Empty);
        }
Ejemplo n.º 2
0
        public void Format_Value_From_TextBox()
        {
            var sut = new NZazuDateField(new FieldDefinition {
                Key = "key"
            }, ServiceLocator);
            var datePicker = (DatePicker)sut.ValueControl;

            sut.Value.Should().NotHaveValue();
            datePicker.Text.Should().BeEmpty();

            var now = DateTime.Now.Date;

            datePicker.SelectedDate = now;
            sut.Value.Should().Be(now);

            datePicker.SelectedDate = null;
            sut.IsValid().Should().BeTrue();
            sut.Value.Should().NotHaveValue();
        }