public void AreNotEquivalentShouldFailWhenFalse() { // arrange var assert = new Asserter(); var notExpected = new List <object>() { new object(), new object(), new object(), }; var actual = new List <object>() { notExpected[2], notExpected[0], notExpected[1], }; var comparer = EqualityComparer <object> .Default; try { // act assert.AreNotEquivalent(notExpected, actual, comparer); } catch (AssertFailedException) { // assert return; } Assert.Fail("An exception was expected, but not thrown."); }
public void AreNotEquivalentShouldPassWhenTrue() { // arrange var assert = new Asserter(); var notExpected = new List <object>() { new object(), new object(), new object(), }; var actual = new List <object>() { notExpected[2], notExpected[1], new object(), }; var comparer = EqualityComparer <object> .Default; // act, assert assert.AreNotEquivalent(notExpected, actual, comparer); }
public void AreNotEquivalentShouldNotAllowNullComparer() { // arrange var assert = new Asserter(); var notExpected = new object[0]; var actual = new object[0]; var comparer = default(IEqualityComparer <object>); try { // act assert.AreNotEquivalent(notExpected, actual, comparer); } catch (AssertFailedException ex) { Assert.AreEqual(GetExpectedMessage(nameof(comparer)), ex.Message); return; } Assert.Fail("An exception was expected, but not thrown."); }