Наследование: AbstractResourceMessage
Пример #1
0
 public void ShowDependenciesMessageExpectsNothingWithNullResource()
 {
     lock (syncroot)
     {
         CreateFullExportsAndVm();
         var msg = new ShowDependenciesMessage(null);
         _mainViewModel.Handle(msg);
         Assert.IsTrue(
             _mainViewModel.Items.All(
                 i => i.WorkSurfaceKey.WorkSurfaceContext != WorkSurfaceContext.DependencyVisualiser));
     }
 }
Пример #2
0
 public void ShowDependenciesMessageExpectsDependencyVisualizerWithResource()
 {
     lock (syncroot)
     {
         CreateFullExportsAndVm();
         var msg = new ShowDependenciesMessage(_firstResource.Object);
         _mainViewModel.Handle(msg);
         var ctx = _mainViewModel.ActiveItem;
         var vm = ctx.WorkSurfaceViewModel as DependencyVisualiserViewModel;
         Assert.IsTrue(vm.ResourceModel.Equals(_firstResource.Object));
     }
 }
Пример #3
0
 public void ShowDependenciesMessageExpectsDependencyVisualizerWithResource()
 {
     CreateFullExportsAndVm();
     var msg = new ShowDependenciesMessage(FirstResource.Object);
     MainViewModel.Handle(msg);
     var ctx = MainViewModel.ActiveItem;
     var vm = ctx.WorkSurfaceViewModel as DependencyVisualiserViewModel;
     Assert.IsNotNull(vm);
     // ReSharper disable PossibleNullReferenceException
     Assert.IsTrue(vm.ResourceModel.Equals(FirstResource.Object));
     // ReSharper restore PossibleNullReferenceException
 }
Пример #4
0
        public void MainViewModel_CloseWorkSurfaceContext_PreviousItemActivatedAndCorrectlySet()
        {
            CreateFullExportsAndVm();
            AddAdditionalContext();
            AddAdditionalContext();
            Assert.AreEqual(3, MainViewModel.Items.Count);

            FirstResource.Setup(r => r.IsAuthorized(AuthorizationContext.Contribute)).Returns(true);
            SecondResource.Setup(r => r.IsAuthorized(AuthorizationContext.Contribute)).Returns(true);

            var firstCtx = MainViewModel.FindWorkSurfaceContextViewModel(FirstResource.Object);
            var secondCtx = MainViewModel.FindWorkSurfaceContextViewModel(SecondResource.Object);

            MainViewModel.ActivateItem(firstCtx);
            MainViewModel.ActivateItem(secondCtx);
            MainViewModel.ActivateItem(firstCtx);
            var msg = new ShowDependenciesMessage(FirstResource.Object);
            MainViewModel.Handle(msg);
            var dependencyCtx = MainViewModel.ActiveItem;
            var vm = dependencyCtx.WorkSurfaceViewModel as DependencyVisualiserViewModel;
            Assert.IsNotNull(vm);
            //Assert.IsTrue(vm.ResourceModel.Equals(_firstResource.Object));

            MainViewModel.DeactivateItem(dependencyCtx, false);

            Assert.IsTrue(MainViewModel.ActiveItem.Equals(firstCtx));
        }
Пример #5
0
 public void IHandleShowDependenciesActivatesReverseDependecies()
 {
     CreateFullExportsAndVm();
     var msg = new ShowDependenciesMessage(FirstResource.Object, true);
     MainViewModel.Handle(msg);
     Assert.AreEqual(MainViewModel.ActiveItem.WorkSurfaceKey.WorkSurfaceContext, WorkSurfaceContext.ReverseDependencyVisualiser);
 }