public void ZeroAsSetSecondsTurnsOnOnlyTopDiode() { BerlinClockTimeRepresentation timeRepresentation = new BerlinClockTimeRepresentation(); timeRepresentation.SetSeconds(0); Assert.IsTrue(timeRepresentation.FirstRow.All(x => !x.IsOn)); Assert.IsTrue(timeRepresentation.SecondRow.All(x => !x.IsOn)); Assert.IsTrue(timeRepresentation.ThirdRow.All(x => !x.IsOn)); Assert.IsTrue(timeRepresentation.ForthRow.All(x => !x.IsOn)); Assert.IsTrue(timeRepresentation.TopDiode.IsOn); }
public void FiftyNineAsSetSecondsTurnsOnNoneOfDiodes() { BerlinClockTimeRepresentation timeRepresentation = new BerlinClockTimeRepresentation(); timeRepresentation.SetSeconds(59); Assert.IsTrue(timeRepresentation.FirstRow.All(x => !x.IsOn)); Assert.IsTrue(timeRepresentation.SecondRow.All(x => !x.IsOn)); Assert.IsTrue(timeRepresentation.ThirdRow.All(x => !x.IsOn)); Assert.IsTrue(timeRepresentation.ForthRow.All(x => !x.IsOn)); Assert.IsFalse(timeRepresentation.TopDiode.IsOn); }
public BerlinClockTimeRepresentation RepresentTime(TimeSpan timeInput) { if (timeInput.TotalHours > 24.0) { throw new ArgumentException(string.Format("Hours cannot exeed 24. Got {0}", timeInput)); } BerlinClockTimeRepresentation timeRepresentation = berlinClockFactory.BuildNew(); timeRepresentation.ResetClock(); if (timeInput == OneFullDay) { timeRepresentation.SetHours(24); } else { timeRepresentation.SetHours(timeInput.Hours); } timeRepresentation.SetMinutes(timeInput.Minutes); timeRepresentation.SetSeconds(timeInput.Seconds); return(timeRepresentation); }