Exemple #1
0
        public void HashSetsSame()
        {
            HashSetWrapper hashSet1 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };
            HashSetWrapper hashSet2 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };

            HashSetClass secondClassObject1 = new HashSetClass
            {
                Id = 1
            };
            HashSetClass secondClassObject2 = new HashSetClass
            {
                Id = 1
            };

            hashSet1.HashSetCollection.Add(secondClassObject1);
            hashSet2.HashSetCollection.Add(secondClassObject2);

            ComparisonResult result = _compare.Compare(hashSet1, hashSet2);

            if (!result.AreEqual)
            {
                throw new Exception(result.DifferencesString);
            }
        }
Exemple #2
0
        public void HashSetsDifferent()
        {
            HashSetWrapper hashSet1 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };
            HashSetWrapper hashSet2 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };

            HashSetClass secondClassObject1 = new HashSetClass
            {
                Id = 1
            };
            HashSetClass secondClassObject2 = new HashSetClass
            {
                Id = 2
            };

            hashSet1.HashSetCollection.Add(secondClassObject1);
            hashSet2.HashSetCollection.Add(secondClassObject2);

            Assert.IsFalse(_compare.Compare(hashSet1, hashSet2).AreEqual);
        }
Exemple #3
0
        public void HashSetsMultipleItemsWithIgnoreCollectionOrderTest()
        {
            HashSetWrapper hashSet1 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };
            HashSetWrapper hashSet2 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };

            HashSetClass secondClassObject1 = new HashSetClass
            {
                Id = 1
            };
            HashSetClass secondClassObject2 = new HashSetClass
            {
                Id = 2
            };

            HashSetClass secondClassObject3 = new HashSetClass
            {
                Id = 3
            };
            HashSetClass secondClassObject4 = new HashSetClass
            {
                Id = 4
            };


            hashSet1.HashSetCollection.Add(secondClassObject3);
            hashSet1.HashSetCollection.Add(secondClassObject1);
            hashSet1.HashSetCollection.Add(secondClassObject2);
            hashSet1.HashSetCollection.Add(secondClassObject4);

            hashSet2.HashSetCollection.Add(secondClassObject2);
            hashSet2.HashSetCollection.Add(secondClassObject4);
            hashSet2.HashSetCollection.Add(secondClassObject3);
            hashSet2.HashSetCollection.Add(secondClassObject1);

            _compare.Config.IgnoreCollectionOrder = true;

            ComparisonResult result = _compare.Compare(hashSet1, hashSet2);

            if (!result.AreEqual)
            {
                throw new Exception(result.DifferencesString);
            }
        }
Exemple #4
0
        public void HashSetsMultipleItemsWithIgnoreCollectionOrderNegativeTest()
        {
            HashSetWrapper hashSet1 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };
            HashSetWrapper hashSet2 = new HashSetWrapper
            {
                StatusId = 1,
                Name     = "Paul"
            };

            HashSetClass secondClassObject1 = new HashSetClass
            {
                Id = 1
            };
            HashSetClass secondClassObject2 = new HashSetClass
            {
                Id = 2
            };

            HashSetClass secondClassObject3 = new HashSetClass
            {
                Id = 3
            };
            HashSetClass secondClassObject4 = new HashSetClass
            {
                Id = 4
            };


            hashSet1.HashSetCollection.Add(secondClassObject3);
            hashSet1.HashSetCollection.Add(secondClassObject1);
            hashSet1.HashSetCollection.Add(secondClassObject2);
            hashSet1.HashSetCollection.Add(secondClassObject4);

            hashSet2.HashSetCollection.Add(secondClassObject2);
            hashSet2.HashSetCollection.Add(secondClassObject4);
            hashSet2.HashSetCollection.Add(secondClassObject3);
            hashSet2.HashSetCollection.Add(secondClassObject1);

            _compare.Config.IgnoreCollectionOrder = false;


            Assert.IsFalse(_compare.Compare(hashSet1, hashSet2).AreEqual);
        }