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)); }
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>()); }
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")); }
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")); }