Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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
            }));
        }