/// <summary> /// Updates the properties on the represented business object /// </summary> public override void ApplyChangesToBusinessObject() { LookupComboBoxMapper.ApplyChangesToBusinessObject(); }
public void TestChangeComboBoxUpdatesBusinessObject() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookupID"; LookupComboBoxMapper mapper = new LookupComboBoxMapper(cmbox, propName, false, GetControlFactory()); Sample s = new Sample(); mapper.LookupList = Sample.LookupCollection; s.SampleLookupID = (Guid)GetGuidValue(Sample.LookupCollection, LOOKUP_ITEM_1); mapper.BusinessObject = s; //---------------Execute Test ---------------------- cmbox.SelectedItem = LOOKUP_ITEM_2; mapper.ApplyChangesToBusinessObject(); //---------------Test Result ----------------------- Assert.AreEqual((Guid)GetGuidValue(Sample.LookupCollection, LOOKUP_ITEM_2), s.SampleLookupID); }
public void Test_LookupList_AddItemToComboBox_SelectAdditionalItem_SetsBOPropValueToNull() { //---------------Set up test pack------------------- IComboBox cmbox = GetControlFactory().CreateComboBox(); const string propName = "SampleLookup2ID"; LookupComboBoxMapper mapper = new LookupComboBoxMapper(cmbox, propName, false, GetControlFactory()); Sample sample = new Sample(); mapper.BusinessObject = sample; cmbox.Items.Add("SomeItem"); //---------------Assert Preconditions--------------- Assert.AreEqual(5, cmbox.Items.Count); Assert.AreEqual("SomeItem", LastComboBoxItem(cmbox).ToString()); //---------------Execute Test ---------------------- cmbox.SelectedIndex = cmbox.Items.Count - 1; mapper.ApplyChangesToBusinessObject(); //---------------Test Result ----------------------- object value = sample.GetPropertyValue(propName); Assert.IsNull(value); }