public void Test_AddUpdateBoPropOnValueChangedHandler_WhenMapperUsingHabaneroControl_ShouldAddBehaviours() { //---------------Set up test pack------------------- var dtpWin = new DateTimePickerWin(GetControlFactory()) { Name = "TestComboBox", Enabled = true }; var mapper = new DateTimePickerMapperStub(dtpWin); //---------------Assert Precondition---------------- Assert.IsInstanceOf<IDateTimePicker>(mapper.Control); Assert.IsNull(dtpWin.ValueOrNull); //---------------Execute Test ---------------------- var comboBoxStrategyWin = new DateTimePickerMapperStrategyWin(); comboBoxStrategyWin.AddUpdateBoPropOnValueChangedHandler(mapper); //---------------Assert Result---------------------- mapper.ApplyChangesWasCalled = false; dtpWin.ValueOrNull = dtpWin.Value; Assert.IsTrue(mapper.ApplyChangesWasCalled, "Apply changes should have been called"); }
public void Test_GetMapperType_WhenControlTypeDateTimePickerWin_ShouldReturnDateTimePickerMapper() { //---------------Set up test pack------------------- var registry = CreateWinFormsControlMapperRegistry(); var dateTimePicker = new DateTimePickerWin(new ControlFactoryWin()); //---------------Assert Precondition---------------- Assert.IsNotNull(dateTimePicker); //---------------Execute Test ---------------------- var mapperType = registry.GetMapperType<FakeBo>(dateTimePicker); //---------------Test Result ----------------------- Assert.IsNotNull(mapperType); Assert.AreEqual(typeof(DateTimePickerMapper), mapperType, "Should be DateTimePickerMapper"); }