public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
        {
            string computedClock = berlinClock.convertTime(theTime);

            computedClock = computedClock.Replace("\r", "");
            Assert.AreEqual(computedClock, theExpectedBerlinClockOutput);
        }
예제 #2
0
        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))));
        }
예제 #3
0
        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"));
        }
예제 #4
0
        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"));
        }
예제 #5
0
 public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
 {
     Assert.AreEqual(berlinClock.convertTime(theTime), theExpectedBerlinClockOutput);
 }
 public void convertTimeTest_VerifyIndexOutOfRangeExceptionOnSeparatorOtherThanColon()
 {
     var result = _timeConver.convertTime("24/59/59");
 }
예제 #7
0
 public void ThrowArgumentNull_IfHourOutOfRange()
 {
     berlinClock.convertTime(null);
 }
예제 #8
0
 public string  Execute()
 {
     return(_converter.convertTime(_secondsTimeComponent));
 }
        public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
        {
            var result = berlinClock.convertTime(theTime);

            Assert.AreEqual(theExpectedBerlinClockOutput, result);
        }
예제 #10
0
        public void Throws_When_IncorrectTimeFormat()
        {
            var ex = Assert.Throws <ArgumentException>(() => _berlinClock.convertTime(""));

            Assert.That(ex.Message, Is.EqualTo("Incorrect time format"));
        }
예제 #11
0
 public void ILookAtTheBerlinClock()
 {
     berlinClockTime = berlinClock.convertTime(theTime);
 }
예제 #12
0
 public void Convertime_Test(string time, string expected)
 {
     Assert.Equal(expected, sut.convertTime(time));
 }