Beispiel #1
0
        public void TrainTimeClass_CompareToMethodWithObjectParameter_ReturnsZero_IfParameterIsTimeOfDayObjectWithValueEqualToTimeProperty()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            object    testParam  = testObject.Time.Copy();

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(0, testOutput);
        }
Beispiel #2
0
        public void TrainTimeClass_CompareToMethodWithObjectParameter_ReturnsOne_IfParameterIsTrainTimeObjectWithTimePropertyBeforeTimePropertyOfThisObject()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            object    testParam  = TrainTimeHelpers.GetTrainTimeBefore(testObject.Time);

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(1, testOutput);
        }
Beispiel #3
0
        public void TrainTimeClass_CompareToMethodWithObjectParameter_ReturnsOne_IfParameterIsTimeOfDayObjectWithValueBeforeTimeProperty()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            object    testParam  = _rnd.NextTimeOfDayBefore(testObject.Time);

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(1, testOutput);
        }
Beispiel #4
0
        public void TrainTimeClass_CompareToMethodWithObjectParameter_ThrowsArgumentException_IfParameterTypeIsNotTrainTimeOrTimeOfDay()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            object    testParam  = new object();

            _ = testObject.CompareTo(testParam);

            Assert.Fail();
        }
Beispiel #5
0
        public void TrainTimeClass_CompareToMethodWithTrainTimeParameter_ReturnsZero_IfParameterHasTimePropertyEqualToTimePropertyOfThisObject()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            TrainTime testParam  = TrainTimeHelpers.GetTrainTimeAt(testObject.Time);

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(0, testOutput);
        }
Beispiel #6
0
        public void TrainTimeClass_CompareToMethodWithTrainTimeParameter_ReturnsMinusOne_IfParameterHasTimePropertyLaterThanTimePropertyOfThisObject()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            TrainTime testParam  = TrainTimeHelpers.GetTrainTimeAfter(testObject.Time);

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(-1, testOutput);
        }
Beispiel #7
0
        public void TrainTimeClass_CompareToMethodWithTrainTimeParameter_ReturnsMinusOne_IfParameterIsNull()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            TrainTime testParam  = null;

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(-1, testOutput);
        }
Beispiel #8
0
        public void TrainTimeClass_CompareToMethodWithTimeOfDayParameter_ReturnsMinusOne_IfParameterValueIsLaterThanValueOfTimeProperty()
        {
            TrainTime testObject = TrainTimeHelpers.GetTrainTime();
            TimeOfDay testParam  = _rnd.NextTimeOfDayAfter(testObject.Time);

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(-1, testOutput);
        }
Beispiel #9
0
        public void TrainTimeClass_CompareToMethodWithObjectParameter_ReturnsMinusOne_IfParameterIsTrainTimeObjectWithTimePropertyEqualToNull()
        {
            TrainTime testObject    = TrainTimeHelpers.GetTrainTime();
            TrainTime testTrainTime = TrainTimeHelpers.GetTrainTime();

            testTrainTime.Time = null;
            object testParam = testTrainTime;

            int testOutput = testObject.CompareTo(testParam);

            Assert.AreEqual(-1, testOutput);
        }