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)); }
public void ReturnIncorrectTimeIfParameterIsNullOrEmpty(String emptyTime) { // Arrange var timeParser = new TimeParser(); // Act Time actual = timeParser.GetTimeFromString(emptyTime); // Assert Assert.AreEqual(actual, Time.Incorrect); }
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)); }