public void Test_KeyPressStrategy_UpdatesBusinessObject_WhenEnterKeyPressed()
        {
            //---------------Set up test pack-------------------
            ComboBoxWinStub          cmbox    = new ComboBoxWinStub();
            const string             propName = "SampleLookupID";
            CollectionComboBoxMapper mapper   = new CollectionComboBoxMapper(cmbox, propName, false, GetControlFactory())
            {
                MapperStrategy =
                    GetControlFactory().CreateLookupKeyPressMapperStrategy()
            };
            Car car1;
            Car car2;

            mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2);
            Sample s = new Sample {
                SampleLookupID = car1.CarID
            };

            mapper.BusinessObject = s;
            //---------------Execute Test ----------------------
            cmbox.Text = car2.ToString();
            cmbox.CallSendKeyBob();
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(ComboBoxKeyPressMapperStrategyWin), mapper.MapperStrategy);
            Assert.AreEqual(car2.CarID, s.SampleLookupID);
        }
        public void Test_KeyPressStrategy_UpdatesBusinessObject_WhenEnterKeyPressed()
        {
            //---------------Set up test pack-------------------
            ComboBoxWinStub      cmbox    = new ComboBoxWinStub();
            const string         propName = "SampleLookupID";
            LookupComboBoxMapper mapper   = new LookupComboBoxMapper(cmbox, propName, false, GetControlFactory());

            mapper.MapperStrategy = GetControlFactory().CreateLookupKeyPressMapperStrategy();
            Sample s = new Sample();

            mapper.LookupList     = Sample.LookupCollection;
            s.SampleLookupID      = (Guid)GetGuidValue(Sample.LookupCollection, LOOKUP_ITEM_1);
            mapper.BusinessObject = s;
            //---------------Execute Test ----------------------
            cmbox.Text = "Test2";
            cmbox.CallSendKeyBob();

            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(ComboBoxKeyPressMapperStrategyWin), mapper.MapperStrategy);
            Assert.AreEqual((Guid)GetGuidValue(Sample.LookupCollection, LOOKUP_ITEM_2), s.SampleLookupID);
        }
        public virtual void Test_KeyPressStrategy_UpdatesBusinessObject_WhenEnterKeyPressed()
        {
            //---------------Set up test pack-------------------
            ComboBoxWinStub cmbox = new ComboBoxWinStub();
            BusinessObjectCollection <OrganisationTestBO> boCol;
            RelationshipComboBoxMapper mapper = GetMapperBoColHasOneItem(cmbox, out boCol);

            mapper.MapperStrategy = GetControlFactory().CreateLookupKeyPressMapperStrategy();
            OrganisationTestBO  newBO = boCol.CreateBusinessObject();
            OrganisationTestBO  organisationTestBO = boCol[0];
            ContactPersonTestBO person             = CreateCPWithRelatedOrganisation(organisationTestBO);

            mapper.BusinessObject = person;
            cmbox.Text            = newBO.ToString();
            //---------------Assert Precondition----------------
            Assert.AreNotSame(newBO, person.Organisation, "For Windows the value should be changed.");
            //---------------Execute Test ----------------------
            cmbox.CallSendKeyBob();
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(ComboBoxKeyPressMapperStrategyWin), mapper.MapperStrategy);
            Assert.AreSame(newBO, person.Organisation, "For Windows the value should be changed.");
        }
 public virtual void Test_KeyPressStrategy_UpdatesBusinessObject_WhenEnterKeyPressed()
 {
     //---------------Set up test pack-------------------
     ComboBoxWinStub cmbox = new ComboBoxWinStub();
     BusinessObjectCollection<OrganisationTestBO> boCol;
     RelationshipComboBoxMapper mapper = GetMapperBoColHasOneItem(cmbox, out boCol);
     mapper.MapperStrategy = GetControlFactory().CreateLookupKeyPressMapperStrategy();
     OrganisationTestBO newBO = boCol.CreateBusinessObject();
     OrganisationTestBO organisationTestBO = boCol[0];
     ContactPersonTestBO person = CreateCPWithRelatedOrganisation(organisationTestBO);
     mapper.BusinessObject = person;
     cmbox.Text = newBO.ToString();
     //---------------Assert Precondition----------------
     Assert.AreNotSame(newBO, person.Organisation, "For Windows the value should be changed.");
     //---------------Execute Test ----------------------
     cmbox.CallSendKeyBob();
     //---------------Test Result -----------------------
     Assert.IsInstanceOf(typeof(ComboBoxKeyPressMapperStrategyWin), mapper.MapperStrategy);
     Assert.AreSame(newBO, person.Organisation, "For Windows the value should be changed.");
 }
        public void Test_KeyPressStrategy_UpdatesBusinessObject_WhenEnterKeyPressed()
        {
            //---------------Set up test pack-------------------
            ComboBoxWinStub cmbox = new ComboBoxWinStub();
            const string propName = "SampleLookupID";
            LookupComboBoxMapper mapper = new LookupComboBoxMapper(cmbox, propName, false, GetControlFactory());
            mapper.MapperStrategy = GetControlFactory().CreateLookupKeyPressMapperStrategy();
            Sample s = new Sample();
            mapper.LookupList = Sample.LookupCollection;
            s.SampleLookupID = (Guid)GetGuidValue(Sample.LookupCollection, LOOKUP_ITEM_1);
            mapper.BusinessObject = s;
            //---------------Execute Test ----------------------
            cmbox.Text = "Test2";
            cmbox.CallSendKeyBob();

            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(ComboBoxKeyPressMapperStrategyWin), mapper.MapperStrategy);
            Assert.AreEqual((Guid)GetGuidValue(Sample.LookupCollection, LOOKUP_ITEM_2), s.SampleLookupID);
        }
 public void Test_KeyPressStrategy_UpdatesBusinessObject_WhenEnterKeyPressed()
 {
     //---------------Set up test pack-------------------
     ComboBoxWinStub cmbox = new ComboBoxWinStub();
     const string propName = "SampleLookupID";
     CollectionComboBoxMapper mapper = new CollectionComboBoxMapper(cmbox, propName, false, GetControlFactory())
                                           {
                                               MapperStrategy =
                                                   GetControlFactory().CreateLookupKeyPressMapperStrategy()
                                           };
     Car car1;
     Car car2;
     mapper.BusinessObjectCollection = GetCollectionWithTwoCars(out car1, out car2);
     Sample s = new Sample { SampleLookupID = car1.CarID };
     mapper.BusinessObject = s;
     //---------------Execute Test ----------------------
     cmbox.Text = car2.ToString();
     cmbox.CallSendKeyBob();
     //---------------Test Result -----------------------
     Assert.IsInstanceOf(typeof(ComboBoxKeyPressMapperStrategyWin), mapper.MapperStrategy);
     Assert.AreEqual(car2.CarID, s.SampleLookupID);
 }