示例#1
0
        public void ParseMidnightProperly()
        {
            // Arrange
            var timeParser = new TimeParser();

            // Act
            var actual = timeParser.GetTimeFromString("24:00:00");

            // Assert
            Assert.AreEqual(actual, new Time(24, 0, 0));
        }
示例#2
0
        public void ReturnIncorrectTimeIfParameterIsNullOrEmpty(String emptyTime)
        {
            // Arrange
            var timeParser = new TimeParser();

            // Act
            Time actual = timeParser.GetTimeFromString(emptyTime);

            // Assert
            Assert.AreEqual(actual, Time.Incorrect);
        }
示例#3
0
        public void ParseCorrectTimeProperly(String correctTime)
        {
            // Arrange
            var      timeParser      = new TimeParser();
            DateTime parsedInputTime = DateTime.ParseExact(correctTime, "HH:mm:ss", CultureInfo.CurrentCulture);

            // Act
            Time actual = timeParser.GetTimeFromString(correctTime);

            // Assert
            Assert.AreEqual(actual, new Time(parsedInputTime.Hour, parsedInputTime.Minute, parsedInputTime.Second));
        }