Inheritance: Habanero.Faces.Base.DateTimePickerMapper
        public void Test_AddUpdateBoPropOnValueChangedHandler_WhenMapperUsingControlAdapter_ShouldAddBehaviours()
        {
            //---------------Set up test pack-------------------
            var dtpWin = GetWinFormsControlAdapter();
            var mapper = new DateTimePickerMapperStub(dtpWin); 
            //---------------Assert ComboBoxMapperStub----------------
            Assert.IsInstanceOf<DateTimePicker>(mapper.Control.GetControl());
            Assert.IsInstanceOf<DateTimePicker>(mapper.GetControl());
            //---------------Execute Test ----------------------
            var comboBoxStrategyWin = new DateTimePickerMapperStrategyWin();
            comboBoxStrategyWin.AddUpdateBoPropOnValueChangedHandler(mapper);
            //---------------Assert Result----------------------
        	mapper.ApplyChangesWasCalled = false;
			((DateTimePicker)dtpWin.WrappedControl).Value = DateTime.Now.AddDays(-1);
        	Assert.IsTrue(mapper.ApplyChangesWasCalled, "Apply changes should have been called");
        }
        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_AddUpdateBoPropOnValueChangedHandler_WhenMapperUsingCustomHabaneroControl_ShouldAddBehaviours()
        {
            //---------------Set up test pack-------------------
			var dtpWin = MockRepository.GenerateStub<CustomDateTimePickerStub>();
			IEventRaiser valueChangedEventRaiser = dtpWin.GetEventRaiser(picker => picker.ValueChanged += null);
            var mapper = new DateTimePickerMapperStub(dtpWin);
            //---------------Assert Precondition----------------
            Assert.IsInstanceOf<IDateTimePicker>(mapper.Control);
            Assert.IsNotNull(mapper.Control.GetControl(), "The custom control should support the Control base class");
			Assert.IsNotNull(mapper.GetControl(), "The custom control should support the Control base class");
            //---------------Execute Test ----------------------
            var comboBoxStrategyWin = new DateTimePickerMapperStrategyWin();
            comboBoxStrategyWin.AddUpdateBoPropOnValueChangedHandler(mapper);
            //---------------Assert Result----------------------
        	mapper.ApplyChangesWasCalled = false;
        	valueChangedEventRaiser.Raise(dtpWin, EventArgs.Empty);
        	Assert.IsTrue(mapper.ApplyChangesWasCalled, "Apply changes should have been called");
        }
Exemple #4
0
        public void Test_AddUpdateBoPropOnValueChangedHandler_WhenMapperUsingControlAdapter_ShouldAddBehaviours()
        {
            //---------------Set up test pack-------------------
            var dtpWin = GetWinFormsControlAdapter();
            var mapper = new DateTimePickerMapperStub(dtpWin);

            //---------------Assert ComboBoxMapperStub----------------
            Assert.IsInstanceOf <DateTimePicker>(mapper.Control.GetControl());
            Assert.IsInstanceOf <DateTimePicker>(mapper.GetControl());
            //---------------Execute Test ----------------------
            var comboBoxStrategyWin = new DateTimePickerMapperStrategyWin();

            comboBoxStrategyWin.AddUpdateBoPropOnValueChangedHandler(mapper);
            //---------------Assert Result----------------------
            mapper.ApplyChangesWasCalled = false;
            ((DateTimePicker)dtpWin.WrappedControl).Value = DateTime.Now.AddDays(-1);
            Assert.IsTrue(mapper.ApplyChangesWasCalled, "Apply changes should have been called");
        }
Exemple #5
0
        public void Test_AddUpdateBoPropOnValueChangedHandler_WhenMapperUsingCustomHabaneroControl_ShouldAddBehaviours()
        {
            //---------------Set up test pack-------------------
            var          dtpWin = MockRepository.GenerateStub <CustomDateTimePickerStub>();
            IEventRaiser valueChangedEventRaiser = dtpWin.GetEventRaiser(picker => picker.ValueChanged += null);
            var          mapper = new DateTimePickerMapperStub(dtpWin);

            //---------------Assert Precondition----------------
            Assert.IsInstanceOf <IDateTimePicker>(mapper.Control);
            Assert.IsNotNull(mapper.Control.GetControl(), "The custom control should support the Control base class");
            Assert.IsNotNull(mapper.GetControl(), "The custom control should support the Control base class");
            //---------------Execute Test ----------------------
            var comboBoxStrategyWin = new DateTimePickerMapperStrategyWin();

            comboBoxStrategyWin.AddUpdateBoPropOnValueChangedHandler(mapper);
            //---------------Assert Result----------------------
            mapper.ApplyChangesWasCalled = false;
            valueChangedEventRaiser.Raise(dtpWin, EventArgs.Empty);
            Assert.IsTrue(mapper.ApplyChangesWasCalled, "Apply changes should have been called");
        }
Exemple #6
0
        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");
        }