public void TestFactoryCreatesDiceWithTheCorrectNumberOfSides(int diceCount, int?dieSides, IDiceFactory factory, IDiceSet dice) { "Given a new dice factory" .x(() => factory = new BasicDiceFactory()); "Creating a list of dice with a valid quantity and number of sides" .x(() => dice = factory.Create(diceCount, dieSides)); "Produces dice with the correct number of sides" .x(() => dice.Sides.Should().Be(dieSides)); }
public void TestThatFactoryCreatesBasicDice(int diceCount, int?dieType, IDiceFactory factory, IDiceSet dice) { "Given a new basic dice factory" .x(() => factory = new BasicDiceFactory()); "Creating a list of dice" .x(() => dice = factory.Create(diceCount, dieType)); "Produces the dice of the correct class type" .x(() => dice.First().Should().BeOfType <BasicDie>()); }
public void TestInvalidDiceSidesThrowsException(int diceCount, int?dieSides, IDiceFactory factory, IDiceSet dice, Action act) { "Given a new dice factory" .x(() => factory = new BasicDiceFactory()); "Creating a list of dice with an invalid number of faces on each die" .x(() => act = () => dice = factory.Create(diceCount, dieSides)); "Should throw an exception" .x(() => act.Should().Throw <ArgumentOutOfRangeException>() .WithMessage("must be 2 or greater.\r\nParameter name: type")); }