public void Test_ShowPopupForm_WhenBOisNull_ShouldRaiseError() { //---------------Set up test pack------------------- IControlFactory controlFactory = GetControlFactory(); ExtendedComboBoxWin extendedComboBox = new ExtendedComboBoxWin(controlFactory); const string propName = "OrganisationID"; var mapper = new ExtendedComboBoxMapperSpy( extendedComboBox, propName, true, controlFactory); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- try { mapper.ShowPopupForm(); Assert.Fail("Expected to throw an HabaneroApplicationException"); } //---------------Test Result ----------------------- catch (HabaneroApplicationException ex) { StringAssert.Contains("You cannot Show PopupForm for ExtendedCombobox since the related business object is not set", ex.Message); } }
public void Test_GetIBOGridAndEditorControl_ShouldReturnEditorOnForm() { //---------------Set up test pack------------------- OrganisationTestBO.LoadDefaultClassDef(); IControlFactory controlFactory = GetControlFactory(); ExtendedComboBoxWin extendedComboBox = new ExtendedComboBoxWin(controlFactory); const string propName = "OrganisationID"; var mapper = new ExtendedComboBoxMapperSpy( extendedComboBox, propName, true, controlFactory); mapper.BusinessObject = new ContactPersonTestBO(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- mapper.ShowPopupForm(); var boGridAndEditorControl = mapper.CallGetIBOGridAndEditorControl(); //---------------Test Result ----------------------- IFormHabanero form = mapper.PopupForm; Assert.AreSame(boGridAndEditorControl, form.Controls[0]); }