public void RegularSumOfBestTimeFormatterFormatsTimeAsDash_WhenTimeIsNullRegardlessOfAccuracy(TimeAccuracy timeAccuracy) { var sut = new RegularSumOfBestTimeFormatter { Accuracy = timeAccuracy }; var formattedTime = sut.Format(null); Assert.Equal(TimeFormatConstants.DASH, formattedTime); }
public void RegularSumOfBestTimeFormatterFormatsTimeCorrectly_WhenTimeIsValid(string timespanText, TimeAccuracy timeAccuracy, string expectedTime) { var sut = new RegularSumOfBestTimeFormatter { Accuracy = timeAccuracy }; var time = TimeSpan.Parse(timespanText); var formattedTime = sut.Format(time); Assert.Equal(expectedTime, formattedTime); }
public void TestRegularSumOfBestTimeFormatter(string timespanText, TimeAccuracy timeAccuracy, string expected) { var formatter = new RegularSumOfBestTimeFormatter(); formatter.Accuracy = timeAccuracy; TimeSpan?time = null; if (timespanText != null) { time = TimeSpan.Parse(timespanText); } string formatted = formatter.Format(time); Assert.AreEqual(expected, formatted); }