public void Test_SetDisplayPropertyValue_WithRelatedPropName_ShouldSetPropValue() { //---------------Set up test pack------------------- const string underlyingPropName = "MyRelatedTestProp"; const string propName = "MyRelationship." + underlyingPropName; ClassDef.ClassDefs.Clear(); var myBOClassDef = MyBO.LoadClassDefWithRelationship(); var relatedClassDef = MyRelatedBo.LoadClassDef(); MyBO myBO = (MyBO)myBOClassDef.CreateNewBusinessObject(); MyRelatedBo myRelatedBo = (MyRelatedBo)relatedClassDef.CreateNewBusinessObject(); myBO.Relationships.SetRelatedObject("MyRelationship", myRelatedBo); BOMapper boMapper = new BOMapper(myBO); var initialPropValue = RandomValueGen.GetRandomString(); myRelatedBo.SetPropertyValue(underlyingPropName, initialPropValue); //---------------Assert Precondition---------------- Assert.AreEqual(initialPropValue, myRelatedBo.GetPropertyValue(underlyingPropName)); //---------------Execute Test ---------------------- var expectedPropValue = RandomValueGen.GetRandomString(); boMapper.SetDisplayPropertyValue(propName, expectedPropValue); //---------------Test Result ----------------------- Assert.AreEqual(expectedPropValue, myRelatedBo.GetPropertyValue(underlyingPropName)); }
protected void SetupClassDefs(object propValue) { ClassDef.ClassDefs.Clear(); IClassDef itsClassDef = MyBO.LoadClassDefWithRelationship(); IClassDef itsRelatedClassDef = MyRelatedBo.LoadClassDef(); itsMyBo = (MyBO)itsClassDef.CreateNewBusinessObject(); MyRelatedBo relatedBo = (MyRelatedBo)itsRelatedClassDef.CreateNewBusinessObject(); Guid myRelatedBoGuid = relatedBo.ID.GetAsGuid(); itsMyBo.SetPropertyValue("RelatedID", myRelatedBoGuid); relatedBo.SetPropertyValue("MyRelatedTestProp", propValue); itsMyBo.Save(); relatedBo.Save(); }
public void Test_GetPropertyValue_WithDot() { ClassDef.ClassDefs.Clear(); _itsClassDef = MyBO.LoadClassDefWithRelationship(); _itsRelatedClassDef = MyRelatedBo.LoadClassDef(); //MyBO bo1 = (MyBO)itsClassDef.CreateNewBusinessObject(connection); MyBO bo1 = (MyBO)_itsClassDef.CreateNewBusinessObject(); MyRelatedBo relatedBo = (MyRelatedBo)_itsRelatedClassDef.CreateNewBusinessObject(); Guid myRelatedBoGuid = relatedBo.ID.GetAsGuid(); bo1.SetPropertyValue("RelatedID", myRelatedBoGuid); relatedBo.SetPropertyValue("MyRelatedTestProp", "MyValue"); BOMapper mapper = new BOMapper(bo1); Assert.AreEqual("MyValue", mapper.GetPropertyValueToDisplay("MyRelationship.MyRelatedTestProp")); }