Пример #1
0
        private IGtdContextPresenter GtdContextPresenterFactory(IGtdContext arg)
        {
            IUnityContainer childContainer = _container.CreateChildContainer();

            childContainer.RegisterInstance(arg);
            return(childContainer.Resolve <IGtdContextPresenter>());
        }
Пример #2
0
        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 WorkspaceBuilder With(IGtdContext context)
 {
     return(new WorkspaceBuilder(this)
     {
         _contexts = new ObservableCollection <IGtdContext>(_contexts)
         {
             context
         }
     });
 }
        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);
        }
 private void ContextIsSelected(IGtdContext gtdContext)
 {
     _fakeContextChooser.Setup(x => x.SelectedItem).Returns(gtdContext);
     _fakeContextChooser.Raise(x => x.PropertyChanged += null, new PropertyChangedEventArgs("SelectedItem"));
 }
 private void ContextIsSelected(IGtdContext gtdContext)
 {
     _fakeContextChooser.Setup(x => x.SelectedItem).Returns(gtdContext);
     _fakeContextChooser.Raise(x => x.PropertyChanged += null, new PropertyChangedEventArgs("SelectedItem"));
 }