public void QuitsTheGame() { IGame stubGame = MockRepository.GenerateStub<IGame>(); Quitter quitter = new Quitter(MockRepository.GenerateStub<ISettingsPersister>(), stubGame); quitter.Quit(); stubGame.AssertWasCalled(me => me.Exit()); }
public void SavesSettingsBeforeQuit() { ISettingsPersister stubSettingsSaver = MockRepository.GenerateStub<ISettingsPersister>(); Quitter quitter = new Quitter(stubSettingsSaver, MockRepository.GenerateStub<IGame>()); quitter.Quit(); stubSettingsSaver.AssertWasCalled(me => me.SaveSettings()); }
/// <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); }