public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput) { string computedClock = berlinClock.convertTime(theTime); computedClock = computedClock.Replace("\r", ""); Assert.AreEqual(computedClock, theExpectedBerlinClockOutput); }
public string ConvertTime(int hour, int minute, int second) { int hoursFirstRow = hour; int hoursSecondRow = hour - _hourBiggestFit.GetFit(hour); int minutesFirstRow = minute; int minutesSecondRow = minute - _minuteBiggestFit.GetFit(minute); return(string.Format("{0}\r\n{1}\r\n{2}\r\n{3}\r\n{4}", _lampGenerator.convertTime(Convert.ToString(second)), _topFirstRow.convertTime(Convert.ToString(hoursFirstRow)), _topSecondRow.convertTime(Convert.ToString(hoursSecondRow)), _bottomFirstRow.convertTime(Convert.ToString(minutesFirstRow)), _bottomSecondRow.convertTime(Convert.ToString(minutesSecondRow)))); }
public void AnyExceptionThrownAtTimeInputConversionIsPropagated() { this.berlinClockServiceMock = new Mock <IBerlineClockService>(); this.inputConverterServiceMock = new Mock <ITimeTextInputConverter>(); this.berlinClockVisualisationServiceMock = new Mock <IBerlinClockVisualisationService>(); this.timeConverter = new TimeConverter(this.inputConverterServiceMock.Object, this.berlinClockServiceMock.Object, this.berlinClockVisualisationServiceMock.Object); Exception thrown = new Exception(); this.inputConverterServiceMock.Setup(x => x.Convert(It.IsAny <string>())).Throws(thrown); Assert.Throws(thrown.GetType(), () => timeConverter.convertTime("dd")); }
public void AnyExceptionAtVisualisationStepIsPropagated() { this.berlinClockServiceMock = new Mock <IBerlineClockService>(); this.inputConverterServiceMock = new Mock <ITimeTextInputConverter>(); this.berlinClockVisualisationServiceMock = new Mock <IBerlinClockVisualisationService>(); this.timeConverter = new TimeConverter(this.inputConverterServiceMock.Object, this.berlinClockServiceMock.Object, this.berlinClockVisualisationServiceMock.Object); this.inputConverterServiceMock.Setup(x => x.Convert(It.IsAny <string>())).Returns(new TimeSpan()); Exception thrown = new Exception(); this.berlinClockServiceMock.Setup(x => x.RepresentTime(It.IsAny <TimeSpan>())) .Returns(new BerlinClockTimeRepresentation()); this.berlinClockVisualisationServiceMock .Setup(x => x.TextVisualisation(It.IsAny <BerlinClockTimeRepresentation>())).Throws(thrown); Assert.Throws(thrown.GetType(), () => timeConverter.convertTime("dd")); }
public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput) { Assert.AreEqual(berlinClock.convertTime(theTime), theExpectedBerlinClockOutput); }
public void convertTimeTest_VerifyIndexOutOfRangeExceptionOnSeparatorOtherThanColon() { var result = _timeConver.convertTime("24/59/59"); }
public void ThrowArgumentNull_IfHourOutOfRange() { berlinClock.convertTime(null); }
public string Execute() { return(_converter.convertTime(_secondsTimeComponent)); }
public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput) { var result = berlinClock.convertTime(theTime); Assert.AreEqual(theExpectedBerlinClockOutput, result); }
public void Throws_When_IncorrectTimeFormat() { var ex = Assert.Throws <ArgumentException>(() => _berlinClock.convertTime("")); Assert.That(ex.Message, Is.EqualTo("Incorrect time format")); }
public void ILookAtTheBerlinClock() { berlinClockTime = berlinClock.convertTime(theTime); }
public void Convertime_Test(string time, string expected) { Assert.Equal(expected, sut.convertTime(time)); }