SetSelectedBusinessObject() public method

public SetSelectedBusinessObject ( IBusinessObject bo ) : void
bo IBusinessObject
return void
示例#1
0
        public void Test_SelectButtonWhenClicked_ShouldApplyBusinessObjectChanges()
        {
            //---------------Set up test pack-------------------
            GetClassDefs();
            IControlFactory          controlFactory     = GetControlFactory();
            ExtendedTextBoxVWG       extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            const string             propName           = "OrganisationID";
            ExtendedTextBoxMapperSpy mapperSpy          = new ExtendedTextBoxMapperSpy(
                extendedTextBoxVWG, propName, true, controlFactory);
            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_ShouldApplyBusinessObjectChanges()
 {
     //---------------Set up test pack-------------------
     GetClassDefs();
     IControlFactory controlFactory = GetControlFactory();
     ExtendedTextBoxVWG extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
     const string propName = "OrganisationID";
     ExtendedTextBoxMapperSpy mapperSpy = new ExtendedTextBoxMapperSpy(
         extendedTextBoxVWG, propName, true, controlFactory);
     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);
 }