public void CtorShouldCreateObjectOnCorrectTime() { // Arrange, Act var clock = new BerlinClockImpl(new Time(0, 0, 0)); // Assert Assert.IsNotNull(clock); Assert.IsInstanceOfType(clock, typeof(BerlinClockImpl)); }
public void BlinkerStatusShouldBeCorrect(Int32 timeInInt32, Boolean isBlinkerOn) { // Arrange var time = Time.FromInt32(timeInInt32); // Act var clock = new BerlinClockImpl(time); // Assert Assert.AreEqual(clock.Blinker, isBlinkerOn); }
public void HoursBulbsShouldReturnCorrectNumberOfBulbLightsProperlyPositioned(Int32 timeInInt32, Boolean[] positions) { // Arrange var time = Time.FromInt32(timeInInt32); // Act var clock = new BerlinClockImpl(time); // Assert Assert.AreEqual(clock.HoursBulbs.Count(), 4); Int32 i = 0; Dictionary <Int32, Boolean> result = clock.HoursBulbs.ToDictionary(k => i++, k => k); Assert.IsTrue(result.Aggregate(true, (isValid, bulbLight) => isValid && (positions[bulbLight.Key] == bulbLight.Value), isValid => isValid)); }
[ExpectedException(typeof(ArgumentException))] // Assert public void CtorShouldThrowArgumentExceptionOnIncorrectTime() { // Arrange, Act var clock = new BerlinClockImpl(Time.Incorrect); }