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); }
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); }
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); }
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); }
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)); }