Ejemplo n.º 1
0
        public void TestFactoryCreatesTheCorrectQuantityOfDice(int diceCount, int?dieType, IDiceFactory factory, IDiceSet dice)
        {
            "Given a new Fate dice factory"
            .x(() => factory = new FateDiceFactory());

            "Creating a list of dice with a valid quantity"
            .x(() => dice = factory.Create(diceCount, dieType));

            "Produces the correct quantity of dice"
            .x(() => dice.Count.Should().Be(diceCount));
        }
Ejemplo n.º 2
0
        public void TestThatFactoryCreatesFateDice(int diceCount, int?dieType, IDiceFactory factory, IDiceSet dice)
        {
            "Given a new Fate dice factory"
            .x(() => factory = new FateDiceFactory());

            "Creating a list of dice"
            .x(() => dice = factory.Create(diceCount, dieType));

            "Produces the dice of the correct class type"
            .x(() => dice.First().Should().BeOfType <FateDie>());
        }
Ejemplo n.º 3
0
        public void TestInvalidDiceTypesThrowsException(int diceCount, int?dieType, IDiceFactory factory, IDiceSet dice, Action act)
        {
            "Given a new Fate dice factory"
            .x(() => factory = new FateDiceFactory());

            "Creating a list of dice with an invalid number of faces on each die"
            .x(() => act = () => dice = factory.Create(diceCount, dieType));

            "Should throw an exception"
            .x(() => act.Should().Throw <ArgumentException>()
               .WithMessage("must not be supplied.\r\nParameter name: type"));
        }
Ejemplo n.º 4
0
        public void TestInvalidDiceQuantityThrowsException(int diceCount, int?dieType, IDiceFactory factory, IDiceSet dice, Action act)
        {
            "Given a new Fate dice factory"
            .x(() => factory = new FateDiceFactory());

            "Creating a list of dice with an invalid quantity"
            .x(() => act = () => dice = factory.Create(diceCount, dieType));

            "Should throw an exception"
            .x(() => act.Should().Throw <ArgumentOutOfRangeException>()
               .WithMessage("must be greater than 0.\r\nParameter name: quantity"));
        }