Example #1
0
        public void WithNotStrictOrdering_OfShuffledCollections_ShouldBeEqual()
        {
            var firstCollection  = new[] { "1", "2" };
            var secondCollection = new[] { "2", "1" };
            var firstByValue     = new CollectionByValue <string>(firstCollection, NotStrictOptions);
            var secondByValue    = new CollectionByValue <string>(secondCollection, NotStrictOptions);

            CollectionByValueAssert.AreEqual(firstByValue, secondByValue);
        }
Example #2
0
        public void OfCollectionsOfDifferentTypes_ShouldNotBeEqual()
        {
            var firstCollection  = new byte[] { 1, 2 };
            var secondCollection = new int[] { 1, 2 };
            var firstByValue     = new CollectionByValue <byte>(firstCollection, new Options <byte>(true, null));
            var secondByValue    = new CollectionByValue <int>(secondCollection, new Options <int>(true, null));

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #3
0
        public void WithStrictOrdering_OfCollectionsWithSameItems_ShouldBeEqual()
        {
            var firstCollection  = new[] { "1", "2" };
            var secondCollection = new[] { "1", "2" };
            var firstByValue     = new CollectionByValue <string>(firstCollection, StrictOptions);
            var secondByValue    = new CollectionByValue <string>(secondCollection, StrictOptions);

            CollectionByValueAssert.AreEqual(firstByValue, secondByValue);
        }
Example #4
0
        public void OfNullCollectionsOfDifferentTypes_ShouldNotBeEqual()
        {
            var firstCollection  = (string[])null;
            var secondCollection = (int[])null;
            var firstByValue     = new CollectionByValue <string>(firstCollection, StrictOptions);
            var secondByValue    = new CollectionByValue <int>(secondCollection, new Options <int>(true, null));

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #5
0
        public void OfEmptyCollection_ShouldNotBeEqualToOfNullCollection()
        {
            var firstCollection  = new string[] { };
            var secondCollection = (string[])null;
            var firstByValue     = new CollectionByValue <string>(firstCollection, NotStrictOptions);
            var secondByValue    = new CollectionByValue <string>(secondCollection, NotStrictOptions);

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #6
0
        public void OfNullCollections_ShouldBeEqual()
        {
            var firstCollection  = (string[])null;
            var secondCollection = (string[])null;
            var firstByValue     = new CollectionByValue <string>(firstCollection, StrictOptions);
            var secondByValue    = new CollectionByValue <string>(secondCollection, StrictOptions);

            CollectionByValueAssert.AreEqual(firstByValue, secondByValue);
        }
Example #7
0
        public void OfCollectionsWithDifferentOrdering_WithShuffledItems_ShouldNotBeEqual()
        {
            var firstCollection  = new[] { "1", "2" };
            var secondCollection = new[] { "2", "1" };
            var firstByValue     = new CollectionByValue <string>(firstCollection, StrictOptions);
            var secondByValue    = new CollectionByValue <string>(secondCollection, NotStrictOptions);

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #8
0
        public void OfNullSetsOfDifferentTypes_ShouldNotBeEqual()
        {
            var firstSet      = (ISet <string>)null;
            var secondSet     = (ISet <int>)null;
            var firstByValue  = new SetByValue <string>(firstSet, Options);
            var secondByValue = new SetByValue <int>(secondSet, new Options <int>(true, null));

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #9
0
        public void OfNullSets_ShouldBeEqual()
        {
            var firstSet      = (ISet <string>)null;
            var secondSet     = (ISet <string>)null;
            var firstByValue  = new SetByValue <string>(firstSet, Options);
            var secondByValue = new SetByValue <string>(secondSet, Options);

            CollectionByValueAssert.AreEqual(firstByValue, secondByValue);
        }
Example #10
0
        public void WithCustomComparer_ShouldUseComparer([Values] bool strictOrdering)
        {
            var firstCollection  = new[] { "1", "2" };
            var secondCollection = new[] { "1", "222" };
            var comparer         = new AlwaysEqualsEqualityComparer <string>();
            var firstByValue     = new CollectionByValue <string>(firstCollection, new Options <string>(strictOrdering, comparer));
            var secondByValue    = new CollectionByValue <string>(secondCollection, new Options <string>(strictOrdering, comparer));

            CollectionByValueAssert.AreEqual(firstByValue, secondByValue);
        }
Example #11
0
        public void OfEmptySet_ShouldNotBeEqualToOfNullSet()
        {
            var firstSet      = new HashSet <string> {
            };
            var secondSet     = (ISet <string>)null;
            var firstByValue  = new SetByValue <string>(firstSet, Options);
            var secondByValue = new SetByValue <string>(secondSet, Options);

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #12
0
        public void OfShuffledItems_ShouldBeEqual()
        {
            var firstSet = new HashSet <string> {
                "1", "2"
            };
            var secondSet = new HashSet <string> {
                "2", "1"
            };
            var firstByValue  = new SetByValue <string>(firstSet, Options);
            var secondByValue = new SetByValue <string>(secondSet, Options);

            CollectionByValueAssert.AreEqual(firstByValue, secondByValue);
        }
Example #13
0
        public void OfSetsOfDifferentTypes_ShouldNotBeEqual()
        {
            var firstSet = new HashSet <byte> {
                1, 2
            };
            var secondSet = new HashSet <int> {
                1, 2
            };
            var firstByValue  = new SetByValue <byte>(firstSet, new Options <byte>(true, null));
            var secondByValue = new SetByValue <int>(secondSet, new Options <int>(true, null));

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #14
0
        public void OfSetsWithDifferentItemsCount_ShouldNotBeEqual()
        {
            var firstSet = new HashSet <string> {
                "1", "2"
            };
            var secondSet = new HashSet <string> {
                "1"
            };
            var firstByValue  = new SetByValue <string>(firstSet, Options);
            var secondByValue = new SetByValue <string>(secondSet, Options);

            CollectionByValueAssert.AreNotEqual(firstByValue, secondByValue);
        }
Example #15
0
        public void WithCustomComparer_ShouldUseComparer()
        {
            var firstSet = new HashSet <string> {
                "1", "2"
            };
            var secondSet = new HashSet <string> {
                "1", "222"
            };
            var comparer      = new AlwaysEqualsEqualityComparer <string>();
            var firstByValue  = new SetByValue <string>(firstSet, new Options <string>(false, comparer));
            var secondByValue = new SetByValue <string>(secondSet, new Options <string>(false, comparer));

            CollectionByValueAssert.AreEqual(firstByValue, secondByValue);
        }