master
 1using MbUnit.Framework;
 2using Notepad.Infrastructure.System;
 3using Rhino.Mocks;
 4
 5namespace Notepad.Presentation.Model.Menu.File.Commands {
 6    public class ExitCommandSpecs {}
 7
 8    [TestFixture]
 9    public class when_executing_the_exit_command_specs_ {
10        private MockRepository mockery;
11        private IApplicationEnvironment application;
12
13        [SetUp]
14        public void SetUp() {
15            mockery = new MockRepository();
16            application = mockery.DynamicMock<IApplicationEnvironment>();
17        }
18
19        [Test]
20        public void should_ask_the_application_environment_to_shut_down() {
21            using (mockery.Record()) {
22                application.ShutDown();
23            }
24
25            using (mockery.Playback()) {
26                CreateSUT().Execute();
27            }
28        }
29
30        private IExitCommand CreateSUT() {
31            return new ExitCommand(application);
32        }
33    }
34}