示例#1
0
        public void Execute_GivenContext_SetsActionStateToCommitted()
        {
            _test.Context = AContext.Build();

            _test.Execute(_fakeAction.Object);

            _fakeAction.VerifySet(x => x.ActionState = State.Committed);
        }
        public void Context_WhenSet_RaisesPropertyChanged()
        {
            IGtdContext newContext = AContext.Build();
            var         test       = new Action();

            test.AssertThatChangeNotificationIsRaisedBy(x => x.Context).
            When(() => test.Context = newContext);
            Assert.Same(newContext, test.Context);
        }
示例#3
0
        public void Execute_GivenContext_SetsContextOnAction()
        {
            IGtdContext context = AContext.Build();

            _test.Context = context;

            _test.Execute(_fakeAction.Object);

            _fakeAction.VerifySet(x => x.Context = context);
        }
示例#4
0
        public void Execute_GivenProject_AddsActionToProjectBlockingActions()
        {
            Mock <IAction> mockProject = AnAction.Mock();

            _test.Context = AContext.Build();
            _test.Project = mockProject.Object;

            _test.Execute(_fakeAction.Object);

            mockProject.Verify(x => x.AddBlockingAction(_fakeAction.Object));
        }
        public void GettingContextsCurrentItem_Initially_ReturnsContextFromCommand()
        {
            IGtdContext context = AContext.Build();

            _applyCommand.Context = context;

            DoLaterPresenter test = BuildDefaultDoLaterPresenter();

            test.Initialize();

            _fakeContextChooser.VerifySet(x => x.SelectedItem = context);
        }
        public void GettingApplyCommandContext_WhenContextHasBeenSelected_ReturnsTheContext()
        {
            DoLaterPresenter test = BuildDefaultDoLaterPresenter();

            test.Initialize();

            IGtdContext context = AContext.Build();

            ContextIsSelected(context);

            GC.KeepAlive(test);
            Assert.Same(context, _applyCommand.Context);
        }
示例#7
0
        public void CanExecute_WhenContextSet_IsTrue()
        {
            _test.Context = AContext.Build();

            Assert.True(_test.CanExecute(_fakeAction.Object));
        }