summaryrefslogtreecommitdiff
path: root/src/Notepad/Presentation/Model/Menu/File/NewMenuItemSpecs.cs
blob: 54a7b2035a6e695eb41751462219e3ad58eeb9fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using MbUnit.Framework;
using Notepad.Test.Extensions;
using Rhino.Mocks;

namespace Notepad.Presentation.Model.Menu.File {
    public class NewMenuItemSpecs {}

    [TestFixture]
    public class when_asking_the_new_file_menu_if_it_belongs_to_the_file_menu_ {
        private MockRepository mockery;
        private ISubMenu fileMenu;

        [SetUp]
        public void SetUp() {
            mockery = new MockRepository();
            fileMenu = mockery.DynamicMock<ISubMenu>();

            SetupResult.For(fileMenu.Name()).Return("&File");
        }

        [Test]
        public void should_return_true() {
            using (mockery.Record()) {}

            using (mockery.Playback()) {
                CreateSUT().BelongsTo(fileMenu).ShouldBeEqualTo(true);
            }
        }

        private IMenuItem CreateSUT() {
            return new NewMenuItem();
        }
    }

    [TestFixture]
    public class when_asking_the_new_file_menu_item_for_its_name_ {
        [Test]
        public void should_return_the_correct_name() {
            CreateSUT().Name().ShouldBeEqualTo("&New");
        }

        private IMenuItem CreateSUT() {
            return new NewMenuItem();
        }
    }
}