Exemplo n.º 1
0
        public void Equivalent()
        {
            ICollection set1 = new ICollectionAdapter("x", "y", "z");
            ICollection set2 = new ICollectionAdapter("z", "y", "x");

            CollectionAssert.AreEquivalent(set1, set2);
        }
        public void EquivalentHandlesNull()
        {
            ICollection set1 = new ICollectionAdapter(null, "x", null, "z");
            ICollection set2 = new ICollectionAdapter("z", null, "x", null);

            Assert.That(new CollectionEquivalentConstraint(set1).Matches(set2));
        }
        public void EquivalentHonorsIgnoreCase()
        {
            ICollection set1 = new ICollectionAdapter("x", "y", "z");
            ICollection set2 = new ICollectionAdapter("z", "Y", "X");

            Assert.That(new CollectionEquivalentConstraint(set1).IgnoreCase.Matches(set2));
        }
        public void EquivalentFailsWithDuplicateElementInExpected()
        {
            ICollection set1 = new ICollectionAdapter("x", "y", "x");
            ICollection set2 = new ICollectionAdapter("x", "y", "z");

            Assert.False(new CollectionEquivalentConstraint(set1).Matches(set2));
        }
        public void EquivalentIgnoresOrder()
        {
            ICollection set1 = new ICollectionAdapter("x", "y", "z");
            ICollection set2 = new ICollectionAdapter("z", "y", "x");

            Assert.That(new CollectionEquivalentConstraint(set1).Matches(set2));
        }
Exemplo n.º 6
0
        public void AreEquivalentHandlesNull()
        {
            ICollection set1 = new ICollectionAdapter(null, "x", null, "z");
            ICollection set2 = new ICollectionAdapter("z", null, "x", null);

            CollectionAssert.AreEquivalent(set1, set2);
        }
Exemplo n.º 7
0
        public void ContainsFails_EmptyICollection()
        {
            ICollectionAdapter ca = new ICollectionAdapter(new object[0]);

            expectedMessage =
                "  Expected: collection containing \"x\"" + Environment.NewLine +
                "  But was:  <empty>" + Environment.NewLine;
            CollectionAssert.Contains(ca, "x");
        }
Exemplo n.º 8
0
        public void ContainsFails_ICollection()
        {
            ICollectionAdapter ca = new ICollectionAdapter(new string[] { "x", "y", "z" });

            expectedMessage =
                "  Expected: collection containing \"a\"" + Environment.NewLine +
                "  But was:  < \"x\", \"y\", \"z\" >" + Environment.NewLine;
            CollectionAssert.Contains(ca, "a");
        }
Exemplo n.º 9
0
        public void EquivalentFailTwo()
        {
            ICollection set1 = new ICollectionAdapter("x", "y", "x");
            ICollection set2 = new ICollectionAdapter("x", "y", "z");

            expectedMessage =
                "  Expected: equivalent to < \"x\", \"y\", \"x\" >" + Environment.NewLine +
                "  But was:  < \"x\", \"y\", \"z\" >" + Environment.NewLine;
            CollectionAssert.AreEquivalent(set1, set2);
        }
        public void WorksWithCollectionsOfArrays()
        {
            byte[] array1 = new byte[] { 0x20, 0x44, 0x56, 0x76, 0x1e, 0xff };
            byte[] array2 = new byte[] { 0x42, 0x52, 0x72, 0xef };
            byte[] array3 = new byte[] { 0x20, 0x44, 0x56, 0x76, 0x1e, 0xff };
            byte[] array4 = new byte[] { 0x42, 0x52, 0x72, 0xef };

            ICollection set1 = new ICollectionAdapter(array1, array2);
            ICollection set2 = new ICollectionAdapter(array3, array4);

            Constraint constraint = new CollectionEquivalentConstraint(set1);
            Assert.That(constraint.Matches(set2));

            set2 = new ICollectionAdapter(array4, array3);
            Assert.That(constraint.Matches(set2));
        }
Exemplo n.º 11
0
        public void ContainsFails_ICollection()
        {
            ICollectionAdapter ca = new ICollectionAdapter( new string[] { "x", "y", "z" } );

            expectedMessage =
                "  Expected: collection containing \"a\"" + Environment.NewLine +
                "  But was:  < \"x\", \"y\", \"z\" >" + Environment.NewLine;
            CollectionAssert.Contains(ca,"a");
        }
Exemplo n.º 12
0
        public void ContainsFails_EmptyICollection()
        {
            ICollectionAdapter ca = new ICollectionAdapter( new object[0] );

            expectedMessage =
                "  Expected: collection containing \"x\"" + Environment.NewLine +
                "  But was:  <empty>" + Environment.NewLine;
            CollectionAssert.Contains(ca,"x");
        }
Exemplo n.º 13
0
        public void AreEquivalentHandlesNull()
        {
            ICollection set1 = new ICollectionAdapter( null, "x", null, "z" );
            ICollection set2 = new ICollectionAdapter( "z", null, "x", null );

            CollectionAssert.AreEquivalent(set1,set2);
        }
Exemplo n.º 14
0
        public void ContainsNull_ICollection()
        {
            ICollectionAdapter ca = new ICollectionAdapter(new object[] { 1, 2, 3, null, 4, 5 });

            CollectionAssert.Contains(ca, null);
        }
Exemplo n.º 15
0
 public void ContainsNull_ICollection()
 {
     ICollectionAdapter ca = new ICollectionAdapter( new object[] { 1, 2, 3, null, 4, 5 } );
     CollectionAssert.Contains( ca, null );
 }
        public void EquivalentHonorsUsing()
        {
            ICollection set1 = new ICollectionAdapter("x", "y", "z");
            ICollection set2 = new ICollectionAdapter("z", "Y", "X");

            Assert.That(new CollectionEquivalentConstraint(set1)
                .Using<string>((x, y) => String.Compare(x, y, true))
                .Matches(set2));
        }
Exemplo n.º 17
0
        public void Equivalent()
        {
            ICollection set1 = new ICollectionAdapter( "x", "y", "z" );
            ICollection set2 = new ICollectionAdapter( "z", "y", "x" );

            CollectionAssert.AreEquivalent(set1,set2);
        }
Exemplo n.º 18
0
        public void Contains_ICollection()
        {
            ICollectionAdapter ca = new ICollectionAdapter( new string[] { "x", "y", "z" } );

            CollectionAssert.Contains(ca,"x");
        }
Exemplo n.º 19
0
        public void Contains_ICollection()
        {
            ICollectionAdapter ca = new ICollectionAdapter(new string[] { "x", "y", "z" });

            CollectionAssert.Contains(ca, "x");
        }
Exemplo n.º 20
0
        public void EquivalentFailTwo()
        {
            ICollection set1 = new ICollectionAdapter( "x", "y", "x" );
            ICollection set2 = new ICollectionAdapter( "x", "y", "z" );

            expectedMessage =
                "  Expected: equivalent to < \"x\", \"y\", \"x\" >" + Environment.NewLine +
                "  But was:  < \"x\", \"y\", \"z\" >" + Environment.NewLine;
            CollectionAssert.AreEquivalent(set1,set2);
        }
Exemplo n.º 21
0
 public void CanTestContentsOfCollectionNotImplementingIList()
 {
     ICollectionAdapter ints = new ICollectionAdapter(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
     Assert.That(ints, new CollectionContainsConstraint( 9 ));
 }