public void VerifyThatOkCommandWorks()
        {
            this.dialog = new ParameterTypeMappingDialogViewModel(this.reqIf.Lang, new DatatypeDefinition[] { this.stringDatadef }, null, this.iteration, this.session.Object, this.thingDialogNavigationService.Object);

            foreach (var datatypeDefinitionMappingRowViewModel in this.dialog.MappingRows)
            {
                datatypeDefinitionMappingRowViewModel.MappedThing = this.pt;
            }

            this.dialog.NextCommand.Execute(null);
            Assert.IsTrue(this.dialog.DialogResult.Result.Value);
        }
示例#2
0
        /// <summary>
        /// NavigateModal to the <see cref="ParameterType"/> mapping dialog
        /// </summary>
        private void NavigateToParameterTypeMappingDialog()
        {
            var dialog = new ParameterTypeMappingDialogViewModel(this.reqIf.Lang, this.reqIf.CoreContent.First().DataTypes, this.datatypeDefinitionMap, this.iteration, this.session, this.thingDialogNavigationService);
            var res    = (ParameterTypeMappingDialogResult)this.dialogNavigationService.NavigateModal(dialog);

            if (res == null || !res.Result.HasValue || !res.Result.Value)
            {
                return;
            }

            // set the result of the mapping
            this.datatypeDefinitionMap = res.Map.ToDictionary(x => x.Key, x => x.Value);
            this.NavigateToSpecificationTypeMappingDialog();
        }
        public void Setup()
        {
            this.session = new Mock <ISession>();
            this.dialogNavigationService      = new Mock <IDialogNavigationService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.permissionService            = new Mock <IPermissionService>();
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);
            this.assembler = new Assembler(this.uri);

            this.sitedir        = new SiteDirectory(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.modelsetup     = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.iterationSetup = new IterationSetup(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.domain         = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.srdl           = new SiteReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.mrdl           = new ModelReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                RequiredRdl = this.srdl
            };
            this.sitedir.SiteReferenceDataLibrary.Add(this.srdl);
            this.modelsetup.RequiredRdl.Add(this.mrdl);

            this.model = new EngineeringModel(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                EngineeringModelSetup = this.modelsetup
            };
            this.iteration = new Iteration(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                IterationSetup = this.iterationSetup
            };

            this.sitedir.Model.Add(this.modelsetup);
            this.modelsetup.IterationSetup.Add(this.iterationSetup);
            this.sitedir.Domain.Add(this.domain);
            this.model.Iteration.Add(this.iteration);

            this.person      = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.participant = new Participant(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Person = this.person
            };
            this.sitedir.Person.Add(this.person);
            this.modelsetup.Participant.Add(this.participant);

            this.pt = new BooleanParameterType(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.srdl.ParameterType.Add(this.pt);

            this.session.Setup(x => x.ActivePerson).Returns(this.person);
            this.session.Setup(x => x.OpenIterations).Returns(new Dictionary <Iteration, Tuple <DomainOfExpertise, Participant> > {
                { this.iteration, new Tuple <DomainOfExpertise, Participant>(this.domain, this.participant) }
            });

            this.assembler.Cache.TryAdd(new CacheKey(this.iteration.Iid, null), new Lazy <Thing>(() => this.iteration));
            this.reqIf      = new ReqIF();
            this.reqIf.Lang = "en";
            var corecontent = new ReqIFContent();

            this.reqIf.CoreContent = corecontent;
            this.stringDatadef     = new DatatypeDefinitionString();
            this.boolDatadef       = new DatatypeDefinitionBoolean();
            this.intDatadef        = new DatatypeDefinitionInteger();
            this.realDatadef       = new DatatypeDefinitionReal();
            this.enumDatadef       = new DatatypeDefinitionEnumeration();
            this.enumDatadef.SpecifiedValues.Add(new EnumValue {
                Properties = new EmbeddedValue {
                    Key = 1, OtherContent = "enum1"
                }
            });

            this.dateDatadef = new DatatypeDefinitionDate();

            corecontent.DataTypes.Add(this.stringDatadef);
            corecontent.DataTypes.Add(this.boolDatadef);
            corecontent.DataTypes.Add(this.dateDatadef);
            corecontent.DataTypes.Add(this.enumDatadef);
            corecontent.DataTypes.Add(this.intDatadef);
            corecontent.DataTypes.Add(this.realDatadef);

            this.dialog = new ParameterTypeMappingDialogViewModel(this.reqIf.Lang, corecontent.DataTypes, null, this.iteration, this.session.Object, this.thingDialogNavigationService.Object);
            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.sitedir);
        }