Пример #1
0
        public void TrainTimeClass_GetHashCodeMethod_ReturnsSameValueWhenCalledTwiceOnSameObject_IfObjectPropertiesHaveNotChanged()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();

            int testOutput0 = testObject.GetHashCode();
            int testOutput1 = testObject.GetHashCode();

            Assert.AreEqual(testOutput0, testOutput1);
        }
Пример #2
0
        public void TrainTimeClass_GetHashCodeMethod_ReturnsDifferentValueWhenCalledTwiceOnSameObject_IfObjectFootnotesPropertyHasChanged()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime(_rnd.Next(1, 5));

            int testOutput0 = testObject.GetHashCode();

            testObject.Footnotes.Clear();
            int testOutput1 = testObject.GetHashCode();

            Assert.AreNotEqual(testOutput0, testOutput1);
        }
Пример #3
0
        public void TrainTimeClass_GetHashCodeMethod_ReturnsDifferentValueWhenCalledTwiceOnSameObject_IfObjectTimePropertyHasChanged()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();

            int testOutput0 = testObject.GetHashCode();

            testObject.Time = _rnd.NextBoolean() ? _rnd.NextTimeOfDayAfter(testObject.Time) : _rnd.NextTimeOfDayBefore(testObject.Time);
            int testOutput1 = testObject.GetHashCode();

            Assert.AreNotEqual(testOutput0, testOutput1);
        }
Пример #4
0
        public void TrainTimeClass_GetHashCodeMethod_ReturnsDifferentValueWhenCalledOnDifferentObjects_IfObjectsHaveDifferentTimeProperty()
        {
            TrainTime testObject0 = TrainTimeHelpers.GetTrainTime();
            TrainTime testObject1 = TrainTimeHelpers.GetTrainTimeNotAt(testObject0.Time, 0);

            testObject1.Footnotes.AddRange(testObject0.Footnotes.Select(n => n.Copy()));

            int testOutput0 = testObject0.GetHashCode();
            int testOutput1 = testObject1.GetHashCode();

            Assert.AreNotEqual(testOutput0, testOutput1);
        }
Пример #5
0
        public void TrainTimeClass_GetHashCodeMethod_ReturnsDifferentValueWhenCalledOnDifferentObject_IfObjectsHaveDifferentFootnoteProperties()
        {
            TrainTime testObject0 = TrainTimeHelpers.GetTrainTime(_rnd.Next(1, 5));
            TrainTime testObject1;

            do
            {
                testObject1 = TrainTimeHelpers.GetTrainTimeAt(testObject0.Time);
            } while (testObject0.FootnoteSymbols == testObject1.FootnoteSymbols);

            int testOutput0 = testObject0.GetHashCode();
            int testOutput1 = testObject1.GetHashCode();

            Assert.AreNotEqual(testOutput0, testOutput1);
        }