Exemplo n.º 1
0
        public void VerifyExitIsolation()
        {
            var vm = new GrapherViewModel(this.Option, this.Session.Object, this.thingNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, this.pluginSettingService.Object);

            Assert.AreEqual(1, vm.GraphElements.Count);
            vm.ExitIsolation();
            Assert.AreEqual(1, vm.GraphElements.Count);
        }
Exemplo n.º 2
0
        public void SetsSelectedElementAndSelectedElementPath()
        {
            var vm = new GrapherViewModel(this.Option, this.Session.Object, this.thingNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, this.pluginSettingService.Object);

            Assert.IsNull(vm.SelectedElementModelCode);
            Assert.IsNull(vm.SelectedElement);
            vm.SetsSelectedElementAndSelectedElementPath(vm.GraphElements.FirstOrDefault());
            Assert.IsNotNull(vm.SelectedElementModelCode);
            Assert.IsNotNull(vm.SelectedElement);
        }
Exemplo n.º 3
0
        public void VerifyIsolate()
        {
            var vm = new GrapherViewModel(this.Option, this.Session.Object, this.thingNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, this.pluginSettingService.Object);

            Assert.AreEqual(1, vm.GraphElements.Count);
            var newTrunk = vm.GraphElements.FirstOrDefault();

            Assert.Throws <InvalidOperationException>(() => vm.Isolate(newTrunk));
            Assert.AreEqual(1, vm.GraphElements.Count);
        }
Exemplo n.º 4
0
        public void VerifyProperties()
        {
            var vm = new GrapherViewModel(this.Option, this.Session.Object, this.thingNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, this.pluginSettingService.Object)
            {
                DiagramContextMenuViewModel = this.diagramControlContextMenu.Object
            };

            Assert.IsNotEmpty(vm.GraphElements);
            Assert.IsNotNull(vm.DiagramContextMenuViewModel);

            Assert.IsTrue(vm.GraphElements.All(x =>
                                               x.NestedElementElement.Iid == this.TopElement.Iid ||
                                               x.NestedElementElement.Iid == this.ElementUsage1.Iid ||
                                               x.NestedElementElement.Iid == this.ElementUsage2.Iid ||
                                               x.NestedElementElement.Iid == this.ElementUsage3.Iid
                                               ));

            Assert.IsNotNull(vm.CurrentModel);
            Assert.IsNotNull(vm.CurrentIteration);
            Assert.IsNotNull(vm.CurrentOption);
            Assert.IsNull(vm.SelectedElementModelCode);
            Assert.IsNull(vm.SelectedElement);
        }
Exemplo n.º 5
0
        public void VerifySubscription()
        {
            var vm = new GrapherViewModel(this.Option, this.Session.Object, this.thingNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object, this.pluginSettingService.Object);

            this.EngineeringModelSetup.Name = "updatedShortName";
            CDPMessageBus.Current.SendObjectChangeEvent(this.EngineeringModelSetup, EventKind.Updated);
            Assert.AreEqual(this.EngineeringModelSetup.Name, vm.CurrentModel);

            this.Iteration.TopElement = this.ElementDefinition1;
            CDPMessageBus.Current.SendObjectChangeEvent(this.Iteration, EventKind.Updated);
            Assert.AreEqual(this.Iteration.TopElement, (vm.Thing.Container as Iteration)?.TopElement);

            this.IterationSetup.Description = "updatedDescription";
            CDPMessageBus.Current.SendObjectChangeEvent(this.IterationSetup, EventKind.Updated);
            Assert.AreEqual(this.IterationSetup, (vm.Thing.Container as Iteration)?.IterationSetup);

            this.IterationSetup.Description = "updatedDescription";
            CDPMessageBus.Current.SendObjectChangeEvent(this.IterationSetup, EventKind.Updated);
            Assert.AreEqual(this.IterationSetup, (vm.Thing.Container as Iteration)?.IterationSetup);

            this.Option.Name = "updatedName";
            CDPMessageBus.Current.SendObjectChangeEvent(this.Option, EventKind.Updated);
            Assert.AreEqual(this.Option.Name, vm.Thing.Name);
        }