public void ShouldThrowArgumentOutOfRangeExceptionWhenLampOnCountIsGreaterThenLampCount([Random(0, 5, 1)] int lampCount, [Random(6, 10, 1)] int lampOnCount) { //GIVEN var lampRowValidator = new LampRowValidator(lampCount); //THEN Assert.Throws <ArgumentOutOfRangeException>(() => lampRowValidator.Validate(lampOnCount)); }
public void ShouldNotThrowArgumentOutOfRangeExceptionWhenLampOnCountIsLowerOrEqualLampCount([Random(5, 10, 1)] int lampCount, [Random(0, 5, 1)] int lampOnCount) { //GIVEN var lampRowValidator = new LampRowValidator(lampCount); //THEN Assert.DoesNotThrow(() => lampRowValidator.Validate(lampOnCount)); }
public string Parse(int lampOnCount) { _lampRowValidator.Validate(lampOnCount); var row = new StringBuilder(_lampCount); for (var i = 1; i <= lampOnCount; i++) { row.Append((char)LampSelector().Invoke(i)); } return(row.ToString().PadRight(_lampCount, (char)LampState.Off)); }