예제 #1
0
 public TurnHandler(IJailer jailer, IBanker banker, IMovementHandler movementHandler, IDice dice,
     ICardHandler cardHandler)
 {
     this.jailer = jailer;
     this.banker = banker;
     this.movementHandler = movementHandler;
     this.dice = dice;
     this.cardHandler = cardHandler;
 }
        public void Init()
        {
            fixture = new Fixture().Customize(new AutoMoqCustomization());

            mockDice = fixture.Create<Mock<Dice>>();

            ninject = new StandardKernel(new BindingsModule());

            ninject.Rebind<IDice>().ToConstant(mockDice.Object);

            turnHandler = ninject.Get<TurnHandler>();
            player1 = ninject.Get<IPlayer>();
            player2 = ninject.Get<IPlayer>();
            realtor = ninject.Get<IRealtor>();
            jailer = ninject.Get<IJailer>();
        }
        public void Init()
        {
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            mockDeck = fixture.Create<Mock<IDeck>>();
            mockDice = fixture.Create<Mock<Dice>>();
            mockDeckFactory = fixture.Create<Mock<IDeckFactory>>();
            mockPlayer = fixture.Create<Mock<IPlayer>>();

            ninject = new StandardKernel(new BindingsModule());

            ninject.Rebind<IDice>().ToConstant(mockDice.Object).InSingletonScope();
            ninject.Rebind<IDeckFactory>().ToConstant(mockDeckFactory.Object).InSingletonScope();
            ninject.Rebind<ITaskHandler>().To<TaskHandler>().WithConstructorArgument(PlayerFactory.BuildPlayers(6)); // register six OTHER players

            mockDeckFactory.Setup(x => x.BuildChanceDeck()).Returns(mockDeck.Object);
            mockDeckFactory.Setup(x => x.BuildCommunitiyChestDeck()).Returns(mockDeck.Object);

            turnHandler = ninject.Get<ITurnHandler>();
            player = ninject.Get<IPlayer>();
            realtor = ninject.Get<IRealtor>();

            jailer = ninject.Get<IJailer>();
            taskHandler = ninject.Get<ITaskHandler>();
        }