コード例 #1
0
        public void Initialize__PopulatesPresenters()
        {
            var test = new ProcessActionPresenter(AnAction.Build(), x => new[] {_fakeProcessor.Object});

            test.Initialize();

            Assert.NotEmpty(test.Screens);
        }
コード例 #2
0
        public void Initialize__PopulatesPresenters()
        {
            var test = new ProcessActionPresenter(AnAction.Build(), x => new[] { _fakeProcessor.Object });

            test.Initialize();

            Assert.NotEmpty(test.Screens);
        }
コード例 #3
0
        public void DisplayName__ReturnsActionTitle()
        {
            const string titleOfTheAction = "Title of the action";
            var test = new ProcessActionPresenter(AnAction.Called(titleOfTheAction).Build(),
                                                  x => new[] {_fakeProcessor.Object});

            Assert.Equal(titleOfTheAction, test.DisplayName);
        }
コード例 #4
0
        public void DisplayName__ReturnsActionTitle()
        {
            const string titleOfTheAction = "Title of the action";
            var          test             = new ProcessActionPresenter(AnAction.Called(titleOfTheAction).Build(),
                                                                       x => new[] { _fakeProcessor.Object });

            Assert.Equal(titleOfTheAction, test.DisplayName);
        }
コード例 #5
0
        public void DisplayName_WhenSet_SetsActionTitle()
        {
            Mock<IAction> mockAction = AnAction.Mock();
            var test = new ProcessActionPresenter(mockAction.Object, x => new[] {_fakeProcessor.Object});

            const string newTitle = "New title";
            test.DisplayName = newTitle;

            mockAction.VerifySet(x => x.Title = newTitle);
        }
コード例 #6
0
        public void DisplayName_WhenActionTitleChanges_RaisesPropertyChanged()
        {
            const string titleOfTheAction = "Title of the action";
            Mock<IAction> stubAction = AnAction.Called(titleOfTheAction).Mock();

            var test = new ProcessActionPresenter(stubAction.Object, x => new[] {_fakeProcessor.Object});

            test.AssertThatChangeNotificationIsRaisedBy(x => x.DisplayName).
                When(() => stubAction.Raise(x => x.PropertyChanged += null,
                                            new PropertyChangedEventArgs("Title")));
        }
コード例 #7
0
        public void DisplayName_WhenActionTitleChanges_RaisesPropertyChanged()
        {
            const string   titleOfTheAction = "Title of the action";
            Mock <IAction> stubAction       = AnAction.Called(titleOfTheAction).Mock();

            var test = new ProcessActionPresenter(stubAction.Object, x => new[] { _fakeProcessor.Object });

            test.AssertThatChangeNotificationIsRaisedBy(x => x.DisplayName).
            When(() => stubAction.Raise(x => x.PropertyChanged += null,
                                        new PropertyChangedEventArgs("Title")));
        }
コード例 #8
0
        public void DisplayName_WhenSet_SetsActionTitle()
        {
            Mock <IAction> mockAction = AnAction.Mock();
            var            test       = new ProcessActionPresenter(mockAction.Object, x => new[] { _fakeProcessor.Object });

            const string newTitle = "New title";

            test.DisplayName = newTitle;

            mockAction.VerifySet(x => x.Title = newTitle);
        }
コード例 #9
0
        public void Apply__AppliesCurrentPresenter()
        {
            IAction action = AnAction.Build();

            var mockCommand = new Mock<ICommand>();
            _fakeProcessor.Setup(x => x.ApplyCommand).Returns(mockCommand.Object);

            var test = new ProcessActionPresenter(action, x => new[] {_fakeProcessor.Object});
            test.Initialize();

            test.Apply();

            mockCommand.Verify(x => x.Execute(action));
        }
コード例 #10
0
        public void Apply__AppliesCurrentPresenter()
        {
            IAction action = AnAction.Build();

            var mockCommand = new Mock <ICommand>();

            _fakeProcessor.Setup(x => x.ApplyCommand).Returns(mockCommand.Object);

            var test = new ProcessActionPresenter(action, x => new[] { _fakeProcessor.Object });

            test.Initialize();

            test.Apply();

            mockCommand.Verify(x => x.Execute(action));
        }