public void VerifySettingsCanBeDeserialized() { this.SetupData(); Assert.DoesNotThrow(() => { this.pluginSettingsService.Write(this.settings, this.dataTypeDefinitionMapConverter, this.specObjectTypeMapConverter, this.specRelationTypeMapConverter, this.relationGroupTypeMapConverter, this.specificationTypeMapConverter); }); ImportMappingConfiguration newSettings = null; Assert.DoesNotThrow(() => newSettings = new PluginSettingsService().Read <RequirementsModuleSettings>(true, this.dataTypeDefinitionMapConverter, this.specObjectTypeMapConverter, this.specRelationTypeMapConverter, this.relationGroupTypeMapConverter, this.specificationTypeMapConverter).SavedConfigurations.Cast <ImportMappingConfiguration>().First()); Assert.IsNotNull(newSettings); Assert.AreEqual(0, newSettings.DatatypeDefinitionMap.Count); Assert.AreEqual(2, newSettings.SpecObjectTypeMap.Count); Assert.AreEqual(1, newSettings.SpecRelationTypeMap.Count); Assert.AreEqual(0, newSettings.RelationGroupTypeMap.Count); Assert.AreEqual(1, newSettings.SpecificationTypeMap.Count); }
/// <summary> /// Initializes a new instance of the <see cref="RequirementSpecificationMappingDialogViewModel"/> class. /// </summary> /// <param name="thingFactory">The <see cref="ThingFactory"/></param> /// <param name="iteration">The iteration</param> /// <param name="session">The session</param> /// <param name="thingDialogNavigationService">The thing Dialog Navigation Service</param> /// <param name="dialogNavigationService">The <see cref="IDialogNavigationService"/></param> /// <param name="lang">The current langguage code</param> /// <param name="importMappingConfiguration">The <see cref="ImportMappingConfiguration"/></param> public RequirementSpecificationMappingDialogViewModel(ThingFactory thingFactory, Iteration iteration, ISession session, IThingDialogNavigationService thingDialogNavigationService, IDialogNavigationService dialogNavigationService, string lang, ImportMappingConfiguration importMappingConfiguration) : base(iteration, session, thingDialogNavigationService, lang) { this.PreviewRows = new DisposableReactiveList <IRowViewModelBase <Thing> >(); this.thingFactory = thingFactory; this.dialogNavigationService = dialogNavigationService; this.pluginSettingsService = ServiceLocator.Current.GetInstance <IPluginSettingsService>(); this.importMappingConfiguration = importMappingConfiguration; this.PopulateRows(); this.InitializeCommands(); }
/// <summary> /// Initializes a new instance of the <see cref="ReqIfImportMappingManager"/> class /// </summary> /// <param name="reqif">The <see cref="ReqIF"/> object to map</param> /// <param name="session">The <see cref="ISession"/> in which are information shall be written</param> /// <param name="iteration">The <see cref="Iteration"/> in which the information shall be written</param> /// <param name="domain">The active <see cref="DomainOfExpertise"/></param> /// <param name="dialogNavigationService">The <see cref="IDialogNavigationService"/></param> /// <param name="thingDialogNavigationService">The <see cref="IThingDialogNavigationService"/></param> /// <param name="mappingConfiguration">The <see cref="ImportMappingConfiguration"/></param> public ReqIfImportMappingManager(ReqIF reqif, ISession session, Iteration iteration, DomainOfExpertise domain, IDialogNavigationService dialogNavigationService, IThingDialogNavigationService thingDialogNavigationService, ImportMappingConfiguration mappingConfiguration = null) { this.reqIf = reqif; this.session = session; this.iteration = iteration.Clone(false); this.dialogNavigationService = dialogNavigationService; this.thingDialogNavigationService = thingDialogNavigationService; this.currentDomain = domain; this.mappingConfiguration = mappingConfiguration ?? new ImportMappingConfiguration() { ReqIfName = this.reqIf.TheHeader?.Title, ReqIfId = this.reqIf.TheHeader?.Identifier }; }
/// <summary> /// Initializes a new instance of the <see cref="ReqIfImportResult"/> class /// </summary> /// <param name="reqIfObject">The <see cref="ReqIF"/> object</param> /// <param name="iteration">The selected <see cref="Iteration"/></param> /// <param name="mappingConfiguration">The Selected <see cref="ImportMappingConfiguration"/></param> /// <param name="res">A value indicating whether the task in the </param> public ReqIfImportResult(ReqIF reqIfObject, Iteration iteration, ImportMappingConfiguration mappingConfiguration, bool?res) : base(res) { this.ReqIfObject = reqIfObject; this.Iteration = iteration; this.MappingConfiguration = mappingConfiguration; }
private void SetupData() { var datatypeDefinition0 = new DatatypeDefinitionString() { Identifier = this.reqIf.CoreContent?.DataTypes[0].Identifier }; var datatypeDefinition1 = new DatatypeDefinitionString() { Identifier = this.reqIf.CoreContent?.DataTypes[1].Identifier }; var specObjectType0 = new SpecObjectType() { Identifier = this.reqIf.CoreContent?.SpecTypes.OfType <SpecObjectType>().ToList()[0].Identifier }; var specObjectType1 = new SpecObjectType() { Identifier = this.reqIf.CoreContent?.SpecTypes.OfType <SpecObjectType>().ToList()[1].Identifier }; var specRelationType0 = new SpecRelationType() { Identifier = this.reqIf.CoreContent?.SpecTypes.OfType <SpecRelationType>().ToList()[0].Identifier }; this.rule0 = new ParameterizedCategoryRule(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.rule1 = new ParameterizedCategoryRule(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.rule0.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.rule0)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.rule1.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.rule1)); this.category0 = new Category(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.category1 = new Category(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.category0.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.category0)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.category1.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.category1)); var specObjectTypeMap0 = new SpecObjectTypeMap(specObjectType0, new[] { this.rule0, this.rule1 }, new[] { this.category0, this.category1 }, new[] { new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[0].Identifier }, AttributeDefinitionMapKind.NAME), new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[1].Identifier }, AttributeDefinitionMapKind.SHORTNAME) }, true); var specObjectTypeMap1 = new SpecObjectTypeMap(specObjectType1, new[] { this.rule0, this.rule1 }, new[] { this.category0, this.category1 }, new[] { new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[0].Identifier }, AttributeDefinitionMapKind.NAME), new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[1].Identifier }, AttributeDefinitionMapKind.SHORTNAME) }, true); this.binaryRelationshipRule0 = new BinaryRelationshipRule(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.binaryRelationshipRule1 = new BinaryRelationshipRule(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.binaryRelationshipRule0.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.binaryRelationshipRule0)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.binaryRelationshipRule1.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.binaryRelationshipRule1)); var specRelationTypeMap0 = new SpecRelationTypeMap(specRelationType0, new[] { this.rule0, this.rule1 }, new[] { this.category0, this.category1 }, new[] { new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[0].Identifier }, AttributeDefinitionMapKind.NAME), new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[1].Identifier }, AttributeDefinitionMapKind.SHORTNAME) }, new[] { this.binaryRelationshipRule0, this.binaryRelationshipRule1 }); var relationGroupType0 = new RelationGroupType() { Identifier = this.reqIf.CoreContent?.SpecTypes.OfType <SpecRelationType>().ToList()[0].Identifier }; var relationGroupTypeMap0 = new RelationGroupTypeMap(relationGroupType0, new[] { this.rule0, this.rule1 }, new[] { this.category0, this.category1 }, new[] { new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[0].Identifier }, AttributeDefinitionMapKind.NAME), new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[1].Identifier }, AttributeDefinitionMapKind.SHORTNAME) }, new[] { this.binaryRelationshipRule0, this.binaryRelationshipRule1 }); var specificationType0 = this.reqIf.CoreContent?.SpecTypes.OfType <SpecificationType>().First(); var specificationTypeMap0 = new SpecTypeMap(specificationType0, new[] { this.rule0, this.rule1 }, new[] { this.category0, this.category1 }, new[] { new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[0].Identifier }, AttributeDefinitionMapKind.NAME), new AttributeDefinitionMap(new AttributeDefinitionString() { Identifier = this.reqIf.CoreContent?.SpecTypes[0].SpecAttributes[1].Identifier }, AttributeDefinitionMapKind.SHORTNAME) }); this.parameterType0 = new TextParameterType(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.parameterType1 = new TextParameterType(Guid.NewGuid(), this.session.Assembler.Cache, new Uri(this.uri)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.parameterType0.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.parameterType0)); this.session.Assembler.Cache.TryAdd(new CacheKey(this.parameterType1.Iid, this.iteration.Iid), new Lazy <Thing>(() => this.parameterType1)); this.mappingConfiguration = new ImportMappingConfiguration() { Name = "TestName", Description = "TestDescription", DatatypeDefinitionMap = { { datatypeDefinition0, new DatatypeDefinitionMap(datatypeDefinition0, this.parameterType0, new Dictionary <EnumValue, EnumerationValueDefinition>() { { new EnumValue(), new EnumerationValueDefinition() } }) }, { datatypeDefinition1, new DatatypeDefinitionMap(datatypeDefinition1, this.parameterType1, new Dictionary <EnumValue, EnumerationValueDefinition>() { { new EnumValue(), new EnumerationValueDefinition() } }) } }, SpecObjectTypeMap = { { specObjectType0, specObjectTypeMap0 }, { specObjectType1, specObjectTypeMap1 } }, SpecRelationTypeMap = { { specRelationType0, specRelationTypeMap0 } }, RelationGroupTypeMap = { { relationGroupType0, relationGroupTypeMap0 } }, SpecificationTypeMap = { { specificationType0, specificationTypeMap0 } } }; this.settings = new RequirementsModuleSettings() { SavedConfigurations = { this.mappingConfiguration } }; }