コード例 #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);
        }