public void It_Should_Return_ZeroValuesToHold_When_GiveAnEmptyString() { //arrange var consoleInputProcessor = new ConsoleInputProcessor(); var input = ""; //act var diceValuesToHold = consoleInputProcessor.ConvertToDiceValues(input, new DiceValuesToHoldValidator()); //assert Assert.Empty(diceValuesToHold); }
public void It_Should_Throw_InvalidValueToHoldException_When_GiveAnStringWithValidAndInvalidValues() { //arrange var consoleInputProcessor = new ConsoleInputProcessor(); var input = "2, 3, 4, 65"; //act Action actual = () => consoleInputProcessor.ConvertToDiceValues(input, new DiceValuesToHoldValidator()); //assert var exception = Assert.Throws <InvalidValuesToHoldException>(actual); Assert.Equal("One or more invalid dice values: 2, 3, 4, 65", exception.Message); }
public void It_Should_ReturnCorrectDiceValuesToHold_When_GiveAValidString() { //arrange var consoleInputProcessor = new ConsoleInputProcessor(); var input = "2, 6"; //act var diceValuesToHold = consoleInputProcessor.ConvertToDiceValues(input, new DiceValuesToHoldValidator()); //assert Assert.True(diceValuesToHold.SequenceEqual(new List <int> { 2, 6 })); }