/// <summary> /// Executes the <see cref="ImportCommand"/> /// </summary> private void ExecuteImportCommand() { var reqifImportDialogViewModel = new ReqIfImportDialogViewModel(this.Sessions, this.Iterations, new OpenSaveFileDialogService(), new ReqIFDeserializer()); var result = (ReqIfImportResult)this.DialogNavigationService.NavigateModal(reqifImportDialogViewModel); if (result == null || !result.Result.HasValue || !result.Result.Value) { return; } // Start the mapping process, owner cant be null if this is reached var session = this.Sessions.Single(x => x.Assembler.Cache == result.Iteration.Cache); var model = (EngineeringModel)result.Iteration.Container; var activeDomain = model.GetActiveParticipant(session.ActivePerson).SelectedDomain; var reqifToThingMapper = new ReqIfImportMappingManager(result.ReqIfObject, session, result.Iteration, activeDomain, this.DialogNavigationService, this.ThingDialogNavigationService); reqifToThingMapper.StartMapping(); }
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.Add(corecontent); this.datatypedef = new DatatypeDefinitionString(); this.spectype = new SpecificationType(); this.specobjecttype = new SpecObjectType(); corecontent.DataTypes.Add(this.datatypedef); corecontent.SpecTypes.Add(this.spectype); corecontent.SpecTypes.Add(this.specobjecttype); this.importMappingManager = new ReqIfImportMappingManager( this.reqIf, this.session.Object, this.iteration, this.domain, this.dialogNavigationService.Object, this.thingDialogNavigationService.Object); }