コード例 #1
0
        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);
        }
コード例 #2
0
 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() );
     }
 }
コード例 #3
0
 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());
     }
 }
コード例 #4
0
        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);
        }