public void DeltaComponentFormatterFormatsTimeAsDash_WhenTimeIsNullAndAccuracyIsInHundredths() { var sut = new DeltaComponentFormatter(TimeAccuracy.Hundredths, false); var formattedTime = sut.Format(null); Assert.Equal(TimeFormatConstants.DASH, formattedTime); }
public void DeltaComponentFormatterFormatsTimeCorrectly_WhenTimeIsValid(string timespanText, TimeAccuracy timeAccuracy, bool dropDecimals, string expectedDelta) { var sut = new DeltaComponentFormatter(timeAccuracy, dropDecimals: dropDecimals); var time = TimeSpan.Parse(timespanText); var formattedTime = sut.Format(time); Assert.Equal(expectedDelta, formattedTime); }
public DeltaComponent(LiveSplitState state) { Settings = new DeltaSettings() { CurrentState = state }; Formatter = new DeltaComponentFormatter(Settings.Accuracy, Settings.DropDecimals); InternalComponent = new InfoTimeComponent(null, null, Formatter); state.ComparisonRenamed += state_ComparisonRenamed; }
public DeltaComponent(LiveSplitState state) { Settings = new DeltaSettings() { CurrentState = state }; Formatter = new DeltaComponentFormatter(Settings.Accuracy, Settings.DropDecimals); InternalComponent = new InfoTimeComponent(null, null, Formatter); state.ComparisonRenamed += state_ComparisonRenamed; }
public void TestDeltaComponentFormatter(string timespanText, TimeAccuracy timeAccuracy, bool dropDecimals, string expected) { var formatter = new DeltaComponentFormatter(timeAccuracy, dropDecimals: dropDecimals); TimeSpan?time = null; if (timespanText != null) { time = TimeSpan.Parse(timespanText); } string formatted = formatter.Format(time); Assert.AreEqual(expected, formatted); }