Exemplo n.º 1
0
        public void DependencyContainer_Gets_Initialized_And_Used_On_PairChecker()
        {
            // ARRANGE
            DependencyContainer  dependencyContainer  = new DependencyContainer();
            ServerCommunications serverCommunications = new ServerCommunications();
            GameDataManager      gameData             = new GameDataManager();
            IMain main = Substitute.For <IMain>();

            dependencyContainer.Bind <Main>(main as Main);
            dependencyContainer.Bind <GameDataManager>(gameData);
            dependencyContainer.Bind <ServerCommunications>(serverCommunications);

            gameData.currentPowerUps = 2;
            int expected = 1;

            PairChecker pairChecker = new PairChecker();

            pairChecker.Initialize(dependencyContainer);

            // ACT
            pairChecker.UsePowerUp();

            // ASSERT
            Assert.AreEqual(expected, gameData.currentPowerUps);
        }