本文整理汇总了C#中TypeWrapper.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# TypeWrapper.Equals方法的具体用法?C# TypeWrapper.Equals怎么用?C# TypeWrapper.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeWrapper
的用法示例。
在下文中一共展示了TypeWrapper.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Equals_WhenTypeWrapperWrapsType
public void Test_Equals_WhenTypeWrapperWrapsType(Type otherType, bool expectedResult)
{
//---------------Set up test pack-------------------
var type = typeof(FakeEnum);
var typeWrapper = new TypeWrapper(type);
var otherTypeWrapper = new TypeWrapper(otherType);
//---------------Assert Precondition----------------
//---------------Execute Test ----------------------
var isEqual = typeWrapper.Equals(otherTypeWrapper);
//---------------Test Result -----------------------
Assert.AreEqual(expectedResult, isEqual);
}
示例2: Test_Equals_WhenStringNull_ShouldReturnFalse
public void Test_Equals_WhenStringNull_ShouldReturnFalse()
{
//---------------Set up test pack-------------------
var type = typeof(FakeEnum);
var typeWrapper = new TypeWrapper(type);
string someString = null;
//---------------Assert Precondition----------------
Assert.IsNull(someString);
//---------------Execute Test ----------------------
var isEqual = typeWrapper.Equals(someString);
//---------------Test Result -----------------------
Assert.IsFalse(isEqual);
}
示例3: Test_Equals_WhenSecondRefToSelf_ShouldReturnTrue
public void Test_Equals_WhenSecondRefToSelf_ShouldReturnTrue()
{
//---------------Set up test pack-------------------
var type = typeof(FakeEnum);
TypeWrapper typeWrapper = new TypeWrapper(type);
TypeWrapper typeWrapperSecond = typeWrapper;
//---------------Assert Precondition----------------
Assert.AreSame(typeWrapperSecond, typeWrapper);
//---------------Execute Test ----------------------
var isEqual = typeWrapper.Equals(typeWrapperSecond);
//---------------Test Result -----------------------
Assert.IsTrue(isEqual);
}
示例4: Test_Equals_WhenSelfObject_ShouldReturnTrue
public void Test_Equals_WhenSelfObject_ShouldReturnTrue()
{
//---------------Set up test pack-------------------
var type = typeof(FakeEnum);
TypeWrapper typeWrapper = new TypeWrapper(type);
//---------------Assert Precondition----------------
//---------------Execute Test ----------------------
var isEqual = typeWrapper.Equals((object)typeWrapper);
//---------------Test Result -----------------------
Assert.IsTrue(isEqual);
}
示例5: Test_Equals_WhenType
public void Test_Equals_WhenType(Type otherType, bool expectedResult)
{
//---------------Set up test pack-------------------
var type = typeof(FakeEnum);
TypeWrapper typeWrapper = new TypeWrapper(type);
//---------------Assert Precondition----------------
//---------------Execute Test ----------------------
var isEqual = typeWrapper.Equals(otherType);
//---------------Test Result -----------------------
Assert.AreEqual(expectedResult, isEqual
, string.Format("'{0}' Equals '{1}' should be '{2}'"
, otherType, typeWrapper, expectedResult));
}