public void WorksOnTuples() { var actual = new[] { Tuple.Create('a', 1), Tuple.Create('b', 2), Tuple.Create('c', 3), Tuple.Create('d', 4) }; var expected = new[] { Tuple.Create('b', 2), Tuple.Create('c', 3) }; var constraint = new CollectionSupersetConstraint(expected); var constraintResult = constraint.ApplyTo(actual); Assert.That(constraintResult.IsSuccess, Is.True); }
public void HonorsIgnoreCase( IEnumerable expected, IEnumerable actual ) { var constraint = new CollectionSupersetConstraint( expected ).IgnoreCase; var constraintResult = constraint.ApplyTo( actual ); if ( !constraintResult.IsSuccess ) { MessageWriter writer = new TextMessageWriter(); constraintResult.WriteMessageTo( writer ); Assert.Fail( writer.ToString() ); } }
public void HonorsIgnoreCase(IEnumerable expected, IEnumerable actual) { var constraint = new CollectionSupersetConstraint(expected).IgnoreCase; var constraintResult = constraint.ApplyTo(actual); if (!constraintResult.IsSuccess) { MessageWriter writer = new TextMessageWriter(); constraintResult.WriteMessageTo(writer); Assert.Fail(writer.ToString()); } }
public void WorksOnTuples_OneTypeIsntIComparer() { var a = new S { C = 'a' }; var b = new S { C = 'b' }; var c = new S { C = 'c' }; var d = new S { C = 'd' }; var actual = new[] { Tuple.Create(a, 1), Tuple.Create(b, 2), Tuple.Create(c, 3), Tuple.Create(d, 4) }; var expected = new[] { Tuple.Create(b, 2), Tuple.Create(c, 3) }; var constraint = new CollectionSupersetConstraint(expected); var constraintResult = constraint.ApplyTo(actual); Assert.That(constraintResult.IsSuccess, Is.True); }