Beispiel #1
0
 public StageInitializeUseCase(
     IPhaseProvider phaseProvider,
     IPhaseRegister phaseRegister,
     IResidueCharacters residueCharacters,
     IResidueEnemies residueEnemies,
     ICharacterBufferInitializer bufferInitializer,
     ILoadCharacter loadCharacter,
     ILoadStage loadStage,
     IDiceFactory diceFactory,
     ICharacterFactory characterFactory,
     IStageInitializer stageInitializer,
     PanelView.Factory panelFactory)
 {
     _phaseProvider     = phaseProvider;
     _phaseRegister     = phaseRegister;
     _residueCharacters = residueCharacters;
     _residueEnemies    = residueEnemies;
     _bufferInitializer = bufferInitializer;
     _loadCharacter     = loadCharacter;
     _loadStage         = loadStage;
     _diceFactory       = diceFactory;
     _characterFactory  = characterFactory;
     _stageInitializer  = stageInitializer;
     _panelFactory      = panelFactory;
 }
Beispiel #2
0
        public void Init()
        {
            dices = A.CollectionOfFake <IDice>(6).ToArray();

            diceFactory = A.Fake <IDiceFactory>();
            A.CallTo(diceFactory).WithReturnType <IDice>().ReturnsNextFromSequence(dices);

            scoreManager = A.Fake <IScoreManager>();
        }
        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"));
        }
 public DiceRollPresenter(
     IDiceFactory diceFactory,
     IPhaseProvider phaseProvider,
     IDicePhaseFinalizer dicePhaseFinalizer,
     ISkillRollDetail skillRollDetail
     )
 {
     _diceFactory        = diceFactory;
     _phaseProvider      = phaseProvider;
     _dicePhaseFinalizer = dicePhaseFinalizer;
     _skillRollDetail    = skillRollDetail;
 }
Beispiel #6
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"));
        }
Beispiel #7
0
        public Game(IDiceFactory diceFactory, IScoreManager scoreManager)
        {
            rollableDices = new List<IDice>();
            frozenDices = new List<IDice>();

            for (int i = 0; i < 6; i++)
            {
                rollableDices.Add(diceFactory.CreateDice());
            }

            this.scoreManager = scoreManager;
            UpdateScore();
        }
Beispiel #8
0
        public Game(IDiceFactory diceFactory, IScoreManager scoreManager)
        {
            rollableDices = new List <IDice>();
            frozenDices   = new List <IDice>();

            for (int i = 0; i < 6; i++)
            {
                rollableDices.Add(diceFactory.CreateDice());
            }

            this.scoreManager = scoreManager;
            UpdateScore();
        }
Beispiel #9
0
 public GameControllerFactory(IDiceFactory diceRollerFactory, IPlayerFactory computerPlayerFactory)
 {
     this.diceRollerFactory     = diceRollerFactory;
     this.computerPlayerFactory = computerPlayerFactory;
 }
        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));
        }
Beispiel #11
0
        public void Init()
        {
            dices = A.CollectionOfFake<IDice>(6).ToArray();

            diceFactory = A.Fake<IDiceFactory>();
            A.CallTo(diceFactory).WithReturnType<IDice>().ReturnsNextFromSequence(dices);

            scoreManager = A.Fake<IScoreManager>();
        }
Beispiel #12
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));
        }
Beispiel #13
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"));
        }