public void TestGetPropertyValueToDisplay() { ClassDef.ClassDefs.Clear(); _itsClassDef = MyBO.LoadClassDefWithLookup(); MyBO bo1 = (MyBO)_itsClassDef.CreateNewBusinessObject(); bo1.SetPropertyValue("TestProp2", "s1"); BOMapper mapper = new BOMapper(bo1); Assert.AreEqual("s1", mapper.GetPropertyValueToDisplay("TestProp2")); }
public void Test_SetDisplayPropertyValue_WhenLookupList_ShouldSetUnderlyingValue() { //---------------Set up test pack------------------- ClassDef.ClassDefs.Clear(); const string propertyName = "TestProp2"; const string expectedLookupDisplayValue = "s1"; Guid expectedLookupValue; StringUtilities.GuidTryParse("{E6E8DC44-59EA-4e24-8D53-4A43DC2F25E7}", out expectedLookupValue); _itsClassDef = MyBO.LoadClassDefWithLookup(); MyBO bo1 = (MyBO)_itsClassDef.CreateNewBusinessObject(); BOMapper boMapper = new BOMapper(bo1); //---------------Assert Precondition---------------- Assert.IsNullOrEmpty(bo1.TestProp2); //---------------Execute Test ---------------------- boMapper.SetDisplayPropertyValue(propertyName, expectedLookupDisplayValue); //---------------Test Result ----------------------- Assert.AreEqual(expectedLookupValue, bo1.GetPropertyValue(propertyName)); Assert.AreEqual(expectedLookupDisplayValue, bo1.GetPropertyValueToDisplay(propertyName)); }