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(); }
public void Not_Create_Empty_Label() { var sut = new NZazuBoolField(new FieldDefinition { Key = "bool01" }, ServiceLocator); sut.LabelControl.Should().BeNull(); }
public void Support_ThreeState_by_default() { var sut = new NZazuBoolField(new FieldDefinition { Key = "bool01" }, ServiceLocator); ((CheckBox)sut.ValueControl).IsThreeState.Should().BeTrue(); }
public void Be_Creatable() { var sut = new NZazuBoolField(new FieldDefinition { Key = "bool01" }, ServiceLocator); sut.Should().NotBeNull(); sut.Should().BeAssignableTo <INZazuWpfField>(); }
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); }
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); }
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); }
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); }