public void TestCustomFilterValue_changedFiresWhenTextChanged() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); ICustomFilter customFilter = new CustomFilterStub(GetControlFactory()); filterControl.AddCustomFilter("LabelText", customFilter); //---------------Assert pre conditions-------------- Assert.IsFalse(((CustomFilterStub)customFilter)._valueChangedFired); //---------------Execute Test ---------------------- customFilter.Control.Text = "newText"; //---------------Test Result ----------------------- Assert.IsTrue(((CustomFilterStub)customFilter)._valueChangedFired); }
public void TestAdd_CustomFilter() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); ICustomFilter customFilter = new CustomFilterStub(GetControlFactory()); //---------------Execute Test ---------------------- filterControl.AddCustomFilter("LabelText", customFilter); //---------------Test Result ----------------------- Assert.AreEqual(1, filterControl.FilterControls.Count); IControlHabanero controlHabanero = filterControl.GetChildControl("test"); Assert.AreEqual(customFilter.Control, controlHabanero); Assert.IsNotNull(controlHabanero); Assert.IsInstanceOf(typeof(ITextBox), controlHabanero); //---------------Tear Down ------------------------- }
public void Test_AddCustomFilter_WhenControlIsNull_ShouldNotAddToVisualLayout() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); var customFilter = new CustomFilterStub(GetControlFactory()); customFilter.SetBox(null); const string propertyName = "test"; //---------------Assert Precondition---------------- Assert.IsNull(customFilter.Control); Assert.AreEqual(propertyName, customFilter.PropertyName); //---------------Execute Test ---------------------- filterControl.AddCustomFilter(RandomValueGen.GetRandomString(), customFilter); //---------------Test Result ----------------------- Assert.AreEqual(1, filterControl.FilterControls.Count, "Should Be Added To The Set Of CustomFilters"); IControlHabanero controlHabanero = filterControl.GetChildControl(propertyName); Assert.IsNull(controlHabanero, "No control should be added since the custom filter is a non visual filter"); }
public void TestCustomFilterValue_changedFiresWhenTextChanged() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); ICustomFilter customFilter = new CustomFilterStub(GetControlFactory()); #pragma warning disable 618,612 filterControl.AddCustomFilter("LabelText", "test", customFilter); #pragma warning restore 618,612 //---------------Assert pre conditions-------------- Assert.IsFalse(((CustomFilterStub)customFilter)._valueChangedFired); //---------------Execute Test ---------------------- customFilter.Control.Text = "newText"; //---------------Test Result ----------------------- Assert.IsTrue(((CustomFilterStub)customFilter)._valueChangedFired); }
public void TestAdd_CustomFilter() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); ICustomFilter customFilter = new CustomFilterStub(GetControlFactory()); //---------------Execute Test ---------------------- filterControl.AddCustomFilter("LabelText", customFilter); //---------------Test Result ----------------------- Assert.AreEqual(1, filterControl.FilterControls.Count); IControlHabanero controlHabanero = filterControl.GetChildControl("test"); Assert.AreEqual(customFilter.Control, controlHabanero); Assert.IsNotNull(controlHabanero); Assert.IsInstanceOf(typeof(ITextBox),controlHabanero); //---------------Tear Down ------------------------- }