Example #1
0
        public void Be_Creatable()
        {
            var sut = new NZazuTextField(new FieldDefinition {
                Key = "test"
            }, ServiceLocator);

            sut.Should().NotBeNull();
            sut.Should().BeAssignableTo <INZazuWpfField>();
        }
Example #2
0
        public void Create_ValueControl_Even_If_Empty_Hint()
        {
            var sut = new NZazuTextField(new FieldDefinition {
                Key = "test"
            }, ServiceLocator);

            var textBox = (TextBox)sut.ValueControl;

            textBox.Should().NotBeNull();
            textBox.Text.Should().BeEmpty();
        }
Example #3
0
        public void Create_TextBox_with_ToolTip_Matching_Description()
        {
            var sut = new NZazuTextField(new FieldDefinition
            {
                Key         = "test",
                Hint        = "superhero",
                Description = "check this if you are a registered superhero"
            }, ServiceLocator);

            var textBox = (TextBox)sut.ValueControl;

            textBox.Should().NotBeNull();
            textBox.Text.Should().BeEmpty();
            textBox.ToolTip.Should().Be(sut.Definition.Description);
        }
Example #4
0
        public void Get_Set_Value_should_propagate_to_ValueControl_Without_LostFocus()
        {
            var sut = new NZazuTextField(new FieldDefinition {
                Key = "test"
            }, ServiceLocator);
            var textBox = (TextBox)sut.ValueControl;

            textBox.Should().NotBeNull();

            sut.GetValue().Should().BeNull();
            textBox.Text.Should().BeNullOrEmpty();

            sut.SetValue("test");
            sut.GetValue().Should().Be("test");
            textBox.Text.Should().Be("test");

            textBox.Text = string.Empty;
            sut.GetValue().Should().BeNullOrEmpty();
        }