예제 #1
0
        public void QuitsTheGame()
        {
            IGame stubGame = MockRepository.GenerateStub<IGame>();
            Quitter quitter = new Quitter(MockRepository.GenerateStub<ISettingsPersister>(), stubGame);

            quitter.Quit();

            stubGame.AssertWasCalled(me => me.Exit());
        }
예제 #2
0
        public void SavesSettingsBeforeQuit()
        {
            ISettingsPersister stubSettingsSaver = MockRepository.GenerateStub<ISettingsPersister>();
            Quitter quitter = new Quitter(stubSettingsSaver, MockRepository.GenerateStub<IGame>());

            quitter.Quit();

            stubSettingsSaver.AssertWasCalled(me => me.SaveSettings());
        }
예제 #3
0
        /// <summary>
        /// Constructs a new MainMenu object.
        /// </summary>
        public MainMenuScreen(Viewport viewport, SpriteBatch spriteBatch, SpriteFont font, IGameSessionFactory gameSessionFactory, IScreenFactory screenFactory, Quitter quitter) 
            : base(viewport, spriteBatch, font)
        {
            // TODO: There must be a way to reduce the number of parameters here???
            _gameSessionFactory = gameSessionFactory;
            _screenFactory = screenFactory;
            _quitter = quitter;

            // set the transition times
            TransitionOnTime = TimeSpan.FromSeconds(1.0);
            TransitionOffTime = TimeSpan.FromSeconds(0.0);
        }