Esempio n. 1
0
        public void TestInitialize()
        {
            _logicHandler        = Substitute.For <ILogicHandler>();
            _gameEngineInterface = Substitute.For <IGameEngineInterface>();
            _dataLayer           = Substitute.For <IDataLayer>();

            _winLogicProvider = new WinLogicProvider(_logicHandler, _gameEngineInterface, _dataLayer);
        }
Esempio n. 2
0
        public void OnClick_Ok()
        {
            #region arrange
            var gameLogicHandler = Substitute.For <ILogicHandler>();

            var gameEngineInterface = Substitute.For <IGameEngineInterface>();

            var dataLayer = Substitute.For <IDataLayer>();

            var winLogicProvider = new WinLogicProvider(gameLogicHandler, gameEngineInterface, dataLayer);

            #endregion

            #region act
            winLogicProvider.OnClick("btnGameWinOk");
            #endregion

            #region assert
            var uiInputStates = GetPrivateMember <Dictionary <UIInputAxis, bool> >("_uiInputStates", winLogicProvider);
            Assert.IsTrue(uiInputStates[UIInputAxis.btnGameWinOk]);
            #endregion
        }
Esempio n. 3
0
        public void HandleInput_MainMenu()
        {
            #region arrange
            var gameLogicHandler    = Substitute.For <ILogicHandler>();
            var gameEngineInterface = Substitute.For <IGameEngineInterface>();
            var dataLayer           = Substitute.For <IDataLayer>();

            var winLogicProvider = new WinLogicProvider(gameLogicHandler, gameEngineInterface, dataLayer);

            var uiInputStates = new Dictionary <UIInputAxis, bool>();
            uiInputStates.Add(UIInputAxis.btnGameWinOk, true);
            SetPrivateMember("_uiInputStates", winLogicProvider, uiInputStates);
            #endregion

            #region act
            winLogicProvider.HandleInput();
            #endregion

            #region assert
            Assert.IsFalse(uiInputStates[UIInputAxis.btnGameWinOk]);
            gameLogicHandler.Received().SetAppState(AppState.MainMenu);
            #endregion
        }