public void Test_SelectButtonWhenClicked_ShouldApplyBusinessObjectChanges(bool enableEditing) { //---------------Set up test pack------------------- GetClassDefs(); IControlFactory controlFactory = GetControlFactory(); ExtendedTextBoxWin extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory); const string propName = "OrganisationID"; ExtendedTextBoxMapperSpy mapperSpy = new ExtendedTextBoxMapperSpy( extendedTextBoxWin, propName, true, controlFactory); mapperSpy.EnableEditing = enableEditing; ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO(); mapperSpy.BusinessObject = contactPersonTestBo; var expectedSelectedBO = new OrganisationTestBO(); //---------------Assert Precondition---------------- Assert.AreSame(contactPersonTestBo, mapperSpy.BusinessObject); Assert.IsNull(contactPersonTestBo.OrganisationID); //---------------Execute Test ---------------------- mapperSpy.CallSetupPopupForm(); mapperSpy.SetSelectedBusinessObject(expectedSelectedBO); mapperSpy.CallSelectClick(); //---------------Test Result ----------------------- Assert.IsNotNull(contactPersonTestBo.OrganisationID); Assert.AreSame(expectedSelectedBO, contactPersonTestBo.Organisation); }
public void Test_SelectButtonWhenClicked_ShouldClosePopupForm() { GetClassDefs(); IControlFactory controlFactory = GetControlFactory(); ExtendedTextBoxWin extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory); const string propName = "OrganisationID"; ExtendedTextBoxMapperSpy mapperSpy = new ExtendedTextBoxMapperSpy( extendedTextBoxWin, propName, true, controlFactory); ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO(); mapperSpy.BusinessObject = contactPersonTestBo; //---------------Assert Precondition---------------- Assert.IsFalse(mapperSpy.FormClosed); //---------------Execute Test ---------------------- mapperSpy.CallSetupPopupForm(); mapperSpy.CallSelectClick(); //---------------Test Result ----------------------- Assert.IsTrue(mapperSpy.FormClosed); }
public void Test_SelectButtonWhenClicked_AndContactPersonNotValid_ShouldCloseWithoutError_FixBugBug541() { GetClassDefs(); IControlFactory controlFactory = GetControlFactory(); ExtendedTextBoxWin extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory); const string propName = "OrganisationID"; ExtendedTextBoxMapperSpy mapperSpy = new ExtendedTextBoxMapperSpy( extendedTextBoxWin, propName, true, controlFactory); ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO(); mapperSpy.BusinessObject = contactPersonTestBo; mapperSpy.SelectedBO = new OrganisationTestBO(); //---------------Assert Precondition---------------- Assert.IsFalse(mapperSpy.FormClosed); Assert.IsFalse(contactPersonTestBo.Status.IsValid()); Assert.IsTrue(mapperSpy.SelectedBO.Status.IsValid()); Assert.IsNotNull(mapperSpy.SelectedBO); //---------------Execute Test ---------------------- mapperSpy.CallSetupPopupForm(); mapperSpy.CallSelectClick(); //---------------Test Result ----------------------- Assert.IsFalse(contactPersonTestBo.Status.IsValid()); Assert.IsTrue(mapperSpy.FormClosed); }