public void Verify_that_ExecuteBatchDeleteSubscriptionCommand_works_as_expected()
        {
            this.messageBoxService.Setup(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <MessageBoxButton>(), It.IsAny <MessageBoxImage>())).Returns(MessageBoxResult.OK);

            var dialogResult = new CDP4EngineeringModel.ViewModels.Dialogs.CategoryDomainParameterTypeSelectorResult(true, false, Enumerable.Empty <ParameterType>(), Enumerable.Empty <Category>(), Enumerable.Empty <DomainOfExpertise>());

            this.dialogNavigationService.Setup(x => x.NavigateModal(It.IsAny <IDialogViewModel>())).Returns(dialogResult);

            var parameter = new Parameter(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Container     = this.elementDef,
                ParameterType = this.pt,
            };

            parameter.ParameterSubscription.Add(new ParameterSubscription(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Owner = this.domain
            });
            this.elementDef.Parameter.Add(parameter);
            this.iteration.Element.Add(this.elementDef);

            var vm = new ElementDefinitionsBrowserViewModel(this.iteration, this.session.Object, null, null, this.dialogNavigationService.Object, null, this.parameterSubscriptionBatchService.Object, null);

            vm.PopulateContextMenu();

            Assert.AreEqual(2, vm.ContextMenu.Count);

            vm.BatchDeleteSubscriptionCommand.Execute(null);

            this.dialogNavigationService.Verify(x => x.NavigateModal(It.IsAny <IDialogViewModel>()), Times.Exactly(1));

            this.parameterSubscriptionBatchService.Verify(x => x.Delete(this.session.Object, this.iteration, false, It.IsAny <IEnumerable <Category> >(), It.IsAny <IEnumerable <DomainOfExpertise> >(), It.IsAny <IEnumerable <ParameterType> >(), It.IsAny <Func <IEnumerable <Parameter>, bool> >()), Times.Exactly(1));
        }
Beispiel #2
0
        public void Verify_that_ExecuteBatchUpdateParameterCommand_works_as_expected()
        {
            var possibleList = new PossibleFiniteStateList(Guid.NewGuid(), this.cache, this.uri);
            var ps           = new PossibleFiniteState(Guid.NewGuid(), this.cache, this.uri);

            possibleList.PossibleState.Add(ps);

            this.iteration.PossibleFiniteStateList.Add(possibleList);

            var actualList = new ActualFiniteStateList(Guid.NewGuid(), this.cache, this.uri);

            actualList.PossibleFiniteStateList.Add(possibleList);
            var astate = new ActualFiniteState(Guid.NewGuid(), this.cache, this.uri);

            astate.PossibleState.Add(ps);

            actualList.ActualState.Add(astate);

            this.iteration.ActualFiniteStateList.Add(actualList);
            var dialogResult = new CDP4EngineeringModel.ViewModels.Dialogs.CategoryDomainParameterTypeSelectorResult(true, false, Enumerable.Empty <ParameterType>(), Enumerable.Empty <Category>(), Enumerable.Empty <DomainOfExpertise>());

            this.dialogNavigationService.Setup(x => x.NavigateModal(It.IsAny <IDialogViewModel>())).Returns(dialogResult);

            var vm = new FiniteStateBrowserViewModel(this.iteration, this.session.Object, null, null, this.dialogNavigationService.Object, null, this.parameterActualFiniteStateListApplicationBatchService.Object);

            vm.SelectedThing = new ActualFiniteStateListRowViewModel(actualList, this.session.Object, null);

            vm.BatchUpdateParameterCommand.Execute(null);

            this.dialogNavigationService.Verify(x => x.NavigateModal(It.IsAny <IDialogViewModel>()), Times.Exactly(1));

            this.parameterActualFiniteStateListApplicationBatchService.Verify(x => x.Update(this.session.Object, this.iteration, It.IsAny <ActualFiniteStateList>(), false, It.IsAny <IEnumerable <Category> >(), It.IsAny <IEnumerable <DomainOfExpertise> >(), It.IsAny <IEnumerable <ParameterType> >()), Times.Exactly(1));
        }
        public void Verify_that_ExecuteBatchCreateSubscriptionCommand_works_as_expected()
        {
            var dialogResult = new CDP4EngineeringModel.ViewModels.Dialogs.CategoryDomainParameterTypeSelectorResult(true, false, Enumerable.Empty <ParameterType>(), Enumerable.Empty <Category>(), Enumerable.Empty <DomainOfExpertise>());

            this.dialogNavigationService.Setup(x => x.NavigateModal(It.IsAny <IDialogViewModel>())).Returns(dialogResult);

            var vm = new ElementDefinitionsBrowserViewModel(this.iteration, this.session.Object, null, null, this.dialogNavigationService.Object, null, this.parameterSubscriptionBatchService.Object, null);

            vm.PopulateContextMenu();

            Assert.AreEqual(2, vm.ContextMenu.Count);

            vm.BatchCreateSubscriptionCommand.Execute(null);

            this.dialogNavigationService.Verify(x => x.NavigateModal(It.IsAny <IDialogViewModel>()), Times.Exactly(1));

            this.parameterSubscriptionBatchService.Verify(x => x.Create(this.session.Object, this.iteration, false, It.IsAny <IEnumerable <Category> >(), It.IsAny <IEnumerable <DomainOfExpertise> >(), It.IsAny <IEnumerable <ParameterType> >()), Times.Exactly(1));
        }