本文整理汇总了C#中ContactPersonTestBO.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ContactPersonTestBO.GetType方法的具体用法?C# ContactPersonTestBO.GetType怎么用?C# ContactPersonTestBO.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactPersonTestBO
的用法示例。
在下文中一共展示了ContactPersonTestBO.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Create_WhenReflectiveProp_WhenReflectivePropNotExists_ShouldCreateReflectivePropMapper
public void Test_Create_WhenReflectiveProp_WhenReflectivePropNotExists_ShouldCreateReflectivePropMapper()
{
//---------------Set up test pack-------------------
const string propName = "NonExistentReflectiveProp";
var bo = new ContactPersonTestBO();
//---------------Assert Precondition----------------
var propertyInfo = ReflectionUtilities.GetPropertyInfo(bo.GetType(), propName);
Assert.IsNull(propertyInfo);
//---------------Execute Test ----------------------
try
{
BOPropMapperFactory.CreateMapper(bo, propName);
Assert.Fail("Expected to throw an InvalidPropertyException");
}
//---------------Test Result -----------------------
catch (InvalidPropertyException ex)
{
StringAssert.Contains("The property 'NonExistentReflectiveProp' on 'ContactPersonTestBO' cannot be found", ex.Message);
}
}
示例2: Test_SetValue__NewObject_DifferentType_NotInList
public void Test_SetValue__NewObject_DifferentType_NotInList()
{
//---------------Set up test pack-------------------
MyBO.LoadDefaultClassDef();
BOProp boProp = new BOPropLookupList(_propDefGuid);
ContactPersonTestBO.LoadDefaultClassDef();
ContactPersonTestBO newContactPersonTestBO = new ContactPersonTestBO();
//---------------Assert Precondition----------------
Assert.IsNull(boProp.Value);
//---------------Execute Test ----------------------
boProp.Value = newContactPersonTestBO.ID.GetAsValue();
//---------------Test Result -----------------------
Assert.IsNotNull(boProp.Value);
Assert.IsInstanceOf(typeof(Guid), boProp.Value);
Assert.AreEqual(newContactPersonTestBO.ID.GetAsValue(), boProp.Value);
string expectedErrorMessage = String.Format
("{0}' is not valid. The Business object '{1}' returned for this ID is not a type of 'Habanero.Test.MyBO'.",
boProp.DisplayName, newContactPersonTestBO.GetType());
StringAssert.Contains(expectedErrorMessage, boProp.InvalidReason);
Assert.IsFalse(boProp.IsValid);
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:21,代码来源:TestBOPropLookupList_BusinessObjectLookupList_GuidID.cs
示例3: Test_Create_WhenReflectiveProp_WhenNotDefinedWithDash_ShouldCreateReflectivePropMapper
public void Test_Create_WhenReflectiveProp_WhenNotDefinedWithDash_ShouldCreateReflectivePropMapper()
{
//---------------Set up test pack-------------------
const string propName = "ReflectiveProp";
var bo = new ContactPersonTestBO();
//---------------Assert Precondition----------------
var propertyInfo = ReflectionUtilities.GetPropertyInfo(bo.GetType(), propName);
Assert.IsNotNull(propertyInfo);
//---------------Execute Test ----------------------
IBOPropertyMapper propMapper = BOPropMapperFactory.CreateMapper(bo, propName);
//---------------Test Result -----------------------
Assert.IsInstanceOf<ReflectionPropertyMapper>(propMapper);
Assert.AreEqual(propName, propMapper.PropertyName);
Assert.AreSame(bo, propMapper.BusinessObject);
}