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