Пример #1
0
        public void ValueObjectWithIntegerListIsComparableByValueUsingTheEqualsMethod()
        {
            var testObjectOne = new TestObjectWithIntegerList();
            var testObjectTwo = new TestObjectWithIntegerList();

            Assert.AreEqual(testObjectOne, testObjectTwo);
            testObjectTwo.TestListOfIntegers.Add(55);
            Assert.AreNotEqual(testObjectOne, testObjectTwo);
        }
Пример #2
0
        public void ValueObjectWithIntegerListIsComparableByValueUsingOperators()
        {
            var testObjectOne = new TestObjectWithIntegerList();
            var testObjectTwo = new TestObjectWithIntegerList();

            Assert.IsTrue(testObjectOne == testObjectTwo);
            testObjectTwo.TestListOfIntegers.Add(55);
            Assert.IsTrue(testObjectOne != testObjectTwo);
        }
Пример #3
0
        public void ValueObjectWithIntegerListPropertyWorksWithHashSet()
        {
            var hashSet       = new HashSet <TestObjectWithIntegerList>();
            var testObjectOne = new TestObjectWithIntegerList();
            var testObjectTwo = new TestObjectWithIntegerList();

            hashSet.Add(testObjectOne);
            hashSet.Add(testObjectTwo);
            Assert.IsTrue(hashSet.Count == 1);
        }