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