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