예제 #1
0
        public void Get_Set_Value_should_propagate_to_ValueControl()
        {
            var sut = new NZazuBoolField(new FieldDefinition {
                Key = "bool01"
            }, ServiceLocator);

            sut.GetValue().Should().BeEmpty();
            var checkBox = (CheckBox)sut.ValueControl;

            // set
            sut.Value = true;
            checkBox.IsChecked.Should().Be(true);
            sut.GetValue().Should().Be("True");

            sut.SetValue("false");
            checkBox.IsChecked.Should().Be(false);
            sut.GetValue().Should().Be("False");

            sut.SetValue("foobar");
            checkBox.IsChecked.Should().NotHaveValue();

            // get
            checkBox.IsChecked = true;
            sut.GetValue().Should().Be("True");

            checkBox.IsChecked = false;
            sut.GetValue().Should().Be("False");

            checkBox.IsChecked = null;
            sut.GetValue().Should().BeEmpty();
        }
예제 #2
0
        public void Not_Create_Empty_Label()
        {
            var sut = new NZazuBoolField(new FieldDefinition {
                Key = "bool01"
            }, ServiceLocator);

            sut.LabelControl.Should().BeNull();
        }
예제 #3
0
        public void Support_ThreeState_by_default()
        {
            var sut = new NZazuBoolField(new FieldDefinition {
                Key = "bool01"
            }, ServiceLocator);

            ((CheckBox)sut.ValueControl).IsThreeState.Should().BeTrue();
        }
예제 #4
0
        public void Be_Creatable()
        {
            var sut = new NZazuBoolField(new FieldDefinition {
                Key = "bool01"
            }, ServiceLocator);

            sut.Should().NotBeNull();
            sut.Should().BeAssignableTo <INZazuWpfField>();
        }
예제 #5
0
        public void Center_checkboxes_vertically()
        {
            var sut = new NZazuBoolField(new FieldDefinition {
                Key = "bool01"
            }, ServiceLocator);
            var checkBox = (CheckBox)sut.ValueControl;

            checkBox.VerticalContentAlignment.Should().Be(VerticalAlignment.Center);
        }
예제 #6
0
        public void Create_ValueControl_Even_If_Empty_Hint()
        {
            var sut = new NZazuBoolField(new FieldDefinition {
                Key = "bool01"
            }, ServiceLocator);

            var label = (CheckBox)sut.ValueControl;

            label.Should().NotBeNull();
            label.Content.Should().Be(sut.Definition.Hint);
        }
예제 #7
0
        public void Create_Label_Matching_Prompt()
        {
            var sut = new NZazuBoolField(new FieldDefinition {
                Key = "bool01", Prompt = "superhero"
            }, ServiceLocator);

            var label = (Label)sut.LabelControl;

            label.Should().NotBeNull();
            label.Content.Should().Be(sut.Definition.Prompt);
        }
예제 #8
0
        public void Create_ValueControl_Matching_Description()
        {
            var sut = new NZazuBoolField(new FieldDefinition
            {
                Key         = "bool01",
                Hint        = "superhero",
                Description = "check this if you are a registered superhero"
            }, ServiceLocator);

            var label = (CheckBox)sut.ValueControl;

            label.Should().NotBeNull();
            label.Content.Should().Be(sut.Definition.Hint);
            label.ToolTip.Should().Be(sut.Definition.Description);
        }