Пример #1
0
        public void Deserialize(string filepath)
        {
            ReqIFDeserializer deserializer = new ReqIFDeserializer();

            reqif           = deserializer.Deserialize(filepath).First();
            header          = reqif.TheHeader;
            content         = reqif.CoreContent;
            embeddedObjects = reqif.EmbeddedObjects;

            PropertyGrid.DataContext = header;
            specObjectsViewModel     = new SpecObjectsViewModel(content);
            specObjectsViewModel.SpecObjects.CollectionChanged += SpecObjects_CollectionChanged;
            foreach (var specObject in specObjectsViewModel.SpecObjects)
            {
                foreach (var attribute in specObject.Values)
                {
                    attribute.PropertyChanged += Attribute_PropertyChanged;
                }
                foreach (var attribute in specObject.Values)
                {
                    if (attribute.AttributeValue != null)
                    {
                        attribute.AttributeValue.PropertyChanged += AttributeValue_PropertyChanged;
                    }
                }
            }
            initializeColumns();
            MainDataGrid.ItemsSource = specObjectsViewModel.SpecObjects;
        }
Пример #2
0
        public SpecObjectsViewModel(ReqIFContent content)
        {
            foreach (SpecObject specObject in content.SpecObjects)
            {
                SpecobjectViewModel specobjectViewModel = new SpecobjectViewModel()
                {
                    Identifier    = specObject.Identifier,
                    AlternativeId = specObject.AlternativeId,
                    Description   = specObject.Description,
                    LastChange    = specObject.LastChange,
                    LongName      = specObject.LongName,
                    Type          = specObject.Type,
                    SpecType      = specObject.SpecType
                };
                foreach (AttributeDefinition attributeDefinition in content.SpecTypes.Single(x => x == specObject.SpecType).SpecAttributes)
                {
                    AttributeValue attributeValue = specObject.Values.Where(x => x.AttributeDefinition == attributeDefinition).FirstOrDefault();

                    specobjectViewModel.Values.Add(new AttributeValueViewModel()
                    {
                        AttributeValue = attributeValue, AttributeDefinition = attributeDefinition
                    });
                }
                this.SpecObjects.Add(specobjectViewModel);
            }
        }
Пример #3
0
        public void VerifyThatUnkownElementDataTypeDefinitionThrowsArgumentException()
        {
            var reqIfContent = new ReqIFContent();

            string unknownName = "RHEA";

            Assert.Throws <ArgumentException>(() => ReqIfFactory.DatatypeDefinitionConstruct(unknownName, reqIfContent));
        }
Пример #4
0
        public void Verify_that_unknown_SpecTypeName_throws_exception()
        {
            var reqIfContent = new ReqIFContent();

            string unknownName = "RHEA";

            Assert.That(() => ReqIfFactory.SpecTypeConstruct(unknownName, reqIfContent, this.loggerFactory), Throws.Exception.TypeOf <ArgumentException>());
        }
Пример #5
0
        public void Verify_That_Unkown_Element_DataTypeDefinition_Throws_ArgumentException()
        {
            var reqIfContent = new ReqIFContent();

            string unknownName = "RHEA";

            Assert.That(() => ReqIfFactory.DatatypeDefinitionConstruct(unknownName, reqIfContent, this.loggerFactory), Throws.Exception.TypeOf <ArgumentException>());
        }
        /// <summary>
        /// Create and add <see cref="AttributeDefinition"/>s to a <see cref="SpecType"/>
        /// </summary>
        /// <param name="specType">
        /// The <see cref="SpecType"/> to add the <see cref="AttributeDefinition"/>s to
        /// </param>
        /// <param name="reqIfContent">
        /// An instance of <see cref="ReqIFContent"/>
        /// </param>
        private void CreateAndAddAttributeDefinitionsToSpecType(SpecType specType, ReqIFContent reqIfContent)
        {
            var attributeDefinitionBoolean = new AttributeDefinitionBoolean();

            attributeDefinitionBoolean.LongName   = "boolean attribute";
            attributeDefinitionBoolean.Identifier = "specification-boolean-attribute";
            attributeDefinitionBoolean.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionBoolean.Type       = (DatatypeDefinitionBoolean)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionBoolean));
            specType.SpecAttributes.Add(attributeDefinitionBoolean);

            var attributeDefinitionDate = new AttributeDefinitionDate();

            attributeDefinitionDate.LongName   = "date attribute";
            attributeDefinitionDate.Identifier = "specification-date-attribute";
            attributeDefinitionDate.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionDate.Type       = (DatatypeDefinitionDate)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionDate));
            specType.SpecAttributes.Add(attributeDefinitionDate);

            var attributeDefinitionEnumeration = new AttributeDefinitionEnumeration();

            attributeDefinitionEnumeration.LongName   = "enumeration attribute";
            attributeDefinitionEnumeration.Identifier = "specification-enumeration-attribute";
            attributeDefinitionEnumeration.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionEnumeration.Type       = (DatatypeDefinitionEnumeration)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionEnumeration));
            specType.SpecAttributes.Add(attributeDefinitionEnumeration);

            var attributeDefinitionInteger = new AttributeDefinitionInteger();

            attributeDefinitionInteger.LongName   = "integer attribute";
            attributeDefinitionInteger.Identifier = "specification-integer-attribute";
            attributeDefinitionInteger.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionInteger.Type       = (DatatypeDefinitionInteger)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionInteger));
            specType.SpecAttributes.Add(attributeDefinitionInteger);

            var attributeDefinitionReal = new AttributeDefinitionReal();

            attributeDefinitionReal.LongName   = "real attribute";
            attributeDefinitionReal.Identifier = "specification-real-attribute";
            attributeDefinitionReal.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionReal.Type       = (DatatypeDefinitionReal)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionReal));
            specType.SpecAttributes.Add(attributeDefinitionReal);

            var attributeDefinitionString = new AttributeDefinitionString();

            attributeDefinitionString.LongName   = "string attribute";
            attributeDefinitionString.Identifier = "specification-string-attribute";
            attributeDefinitionString.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionString.Type       = (DatatypeDefinitionString)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionString));
            specType.SpecAttributes.Add(attributeDefinitionString);

            var attributeDefinitionXhtml = new AttributeDefinitionXHTML();

            attributeDefinitionXhtml.LongName   = "xhtml attribute";
            attributeDefinitionXhtml.Identifier = "specification-xhtml-attribute";
            attributeDefinitionXhtml.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionXhtml.Type       = (DatatypeDefinitionXHTML)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionXHTML));
            specType.SpecAttributes.Add(attributeDefinitionXhtml);
        }
Пример #7
0
 public void ClearDataGrid()
 {
     content                  = null;
     header                   = null;
     embeddedObjects          = null;
     MainDataGrid.ItemsSource = null;
     MainDataGrid.Columns.Clear();
     MainDataGrid.Items.Refresh();
 }
Пример #8
0
        public void VerifyThatXmlElementNameReturnsDataTypeDefinition()
        {
            var reqIfContent = new ReqIFContent();

            Assert.IsInstanceOf <DatatypeDefinitionBoolean>(ReqIfFactory.DatatypeDefinitionConstruct("DATATYPE-DEFINITION-BOOLEAN", reqIfContent));
            Assert.IsInstanceOf <DatatypeDefinitionDate>(ReqIfFactory.DatatypeDefinitionConstruct("DATATYPE-DEFINITION-DATE", reqIfContent));
            Assert.IsInstanceOf <DatatypeDefinitionEnumeration>(ReqIfFactory.DatatypeDefinitionConstruct("DATATYPE-DEFINITION-ENUMERATION", reqIfContent));
            Assert.IsInstanceOf <DatatypeDefinitionInteger>(ReqIfFactory.DatatypeDefinitionConstruct("DATATYPE-DEFINITION-INTEGER", reqIfContent));
            Assert.IsInstanceOf <DatatypeDefinitionReal>(ReqIfFactory.DatatypeDefinitionConstruct("DATATYPE-DEFINITION-REAL", reqIfContent));
            Assert.IsInstanceOf <DatatypeDefinitionString>(ReqIfFactory.DatatypeDefinitionConstruct("DATATYPE-DEFINITION-STRING", reqIfContent));
            Assert.IsInstanceOf <DatatypeDefinitionXHTML>(ReqIfFactory.DatatypeDefinitionConstruct("DATATYPE-DEFINITION-XHTML", reqIfContent));
        }
Пример #9
0
        public void Verify_Constructor_with_parameters()
        {
            var reqIFContent = new ReqIFContent();

            var specObjectType = new SpecObjectType(reqIFContent, this.loggerFactory);

            var attributeDefinitionReal = new AttributeDefinitionReal(specObjectType, this.loggerFactory);

            var attributeValueReal = new AttributeValueReal(attributeDefinitionReal, this.loggerFactory);

            Assert.That(attributeValueReal.OwningDefinition, Is.EqualTo(attributeDefinitionReal));
        }
        public void SetUp()
        {
            this.resultFileUri = Path.Combine(TestContext.CurrentContext.TestDirectory, "result.xml");

            this.enumdatatype_id      = "enumeration";
            this.enum_value_low_id    = "enumlow";
            this.enum_value_medium_id = "enummedium";

            this.specobject_1_id = "specobject_1";
            this.specobject_2_id = "specobject_2";
            this.specobject_3_id = "specobject_3";

            this.xhtmlcontent = "<xhtml:p>XhtmlPType<xhtml:a accesskey=\"a\" charset=\"UTF-8\" href=\"http://eclipse.org/rmf\" hreflang=\"en\" rel=\"LinkTypes\" rev=\"LinkTypes\" style=\"text-decoration:underline\" tabindex=\"1\" title=\"text\" type=\"text/html\"> text before br<xhtml:br/>text after br text before span<xhtml:span>XhtmlSpanType</xhtml:span>text after span text before em<xhtml:em>XhtmlEmType</xhtml:em>text after em text before strong<xhtml:strong>XhtmlStrongType</xhtml:strong>text after strong text before dfn<xhtml:dfn>XhtmlDfnType</xhtml:dfn>text after dfn text before code<xhtml:code>XhtmlCodeType</xhtml:code>text after code text before samp<xhtml:samp>XhtmlSampType</xhtml:samp>text after samp text before kbd<xhtml:kbd>XhtmlKbdType</xhtml:kbd>text after kbd text before var<xhtml:var>XhtmlVarType</xhtml:var>text after var text before cite<xhtml:cite>XhtmlCiteType</xhtml:cite>text after cite text before abbr<xhtml:abbr>XhtmlAbbrType</xhtml:abbr>text after abbr text before acronym<xhtml:acronym>XhtmlAcronymType</xhtml:acronym>text after acronym text before q<xhtml:q>XhtmlQType</xhtml:q>text after q text before tt<xhtml:tt>XhtmlInlPresType</xhtml:tt>text after tt text before i<xhtml:i>XhtmlInlPresType</xhtml:i>text after i text before b<xhtml:b>XhtmlInlPresType</xhtml:b>text after b text before big<xhtml:big>XhtmlInlPresType</xhtml:big>text after big text before small<xhtml:small>XhtmlInlPresType</xhtml:small>text after small text before sub<xhtml:sub>XhtmlInlPresType</xhtml:sub>text after sub text before sup<xhtml:sup>XhtmlInlPresType</xhtml:sup>text after sup text before ins<xhtml:ins>XhtmlEditType</xhtml:ins>text after ins text before del<xhtml:del>XhtmlEditType</xhtml:del>text after del</xhtml:a></xhtml:p>";

            this.reqIF      = new ReqIF();
            this.reqIF.Lang = "en";

            var header = new ReqIFHeader();

            header.Comment      = "this is a comment";
            header.CreationTime = DateTime.Parse("2015-12-01");
            header.Identifier   = "reqifheader";
            header.RepositoryId = "a repos id";
            header.ReqIFToolId  = "tool - CDP4";
            header.ReqIFVersion = "1.0";
            header.SourceToolId = "source tool - CDP4";
            header.Title        = "this is a title";

            this.reqIF.TheHeader.Add(header);

            var reqIfContent = new ReqIFContent();

            this.reqIF.CoreContent.Add(reqIfContent);

            this.CreateDataTypes();
            this.CreateSpecObjectType();
            this.CreateSpecificationType();
            this.CreateSpecRelationType();
            this.CreateRelationGroupType();

            this.CreateSpecObjects();
            this.CreateSpecRelations();
            this.CreateSpecifications();
            this.CreateRelationGroup();
        }
Пример #11
0
        /// <summary>
        /// Compute the <see cref="ReqIFContent"/> from the registered data
        /// </summary>
        private void BuildCore()
        {
            var content = new ReqIFContent();

            content.DataTypes.AddRange(this.parameterTypeMap.Values);
            // add extra requirement datatype
            content.DataTypes.Add(this.mapper.TextDatatypeDefinition);
            content.DataTypes.Add(this.mapper.BooleanDatatypeDefinition);

            content.Specifications.AddRange(this.requirementSpecificationsMap.Values);
            content.SpecObjects.AddRange(this.requirementMap.Values);
            content.SpecObjects.AddRange(this.requirementsGroupMap.Values);
            content.SpecTypes.AddRange(this.specType.Values.Distinct());

            content.SpecRelations.AddRange(this.specRelationMap.Values);
            content.SpecRelationGroups.AddRange(this.relationGroupMap.Values);

            this.reqIFBuilt.CoreContent.Add(content);
        }
Пример #12
0
        /// <summary>
        /// Queries the <see cref="ExternalObject"/> from a <see cref="ReqIFContent"/> object
        /// </summary>
        /// <param name="reqIfContent">
        /// The <see cref="ReqIFContent"/> to query the <see cref="ExternalObject"/>s from
        /// </param>
        /// <returns>
        /// an <see cref="IEnumerable{ExternalObject}"/>
        /// </returns>
        public static IEnumerable <ExternalObject> QueryExternalObjects(this ReqIFContent reqIfContent)
        {
            var specElementWithAttributesList = new List <SpecElementWithAttributes>();

            specElementWithAttributesList.AddRange(reqIfContent.SpecRelationGroups);
            specElementWithAttributesList.AddRange(reqIfContent.Specifications);
            specElementWithAttributesList.AddRange(reqIfContent.SpecObjects);
            specElementWithAttributesList.AddRange(reqIfContent.SpecRelations);

            var result = new List <ExternalObject>();

            foreach (var specElementWithAttributes in specElementWithAttributesList)
            {
                var externalObjects = specElementWithAttributes.QueryExternalObjects().ToList();

                result.AddRange(externalObjects);
            }

            return(result);
        }
        private void SetupReqIf()
        {
            this.reqIf             = new ReqIF();
            this.reqIf.Lang        = "en";
            this.corecontent       = new ReqIFContent();
            this.reqIf.CoreContent = this.corecontent;
            this.stringDatadef     = new DatatypeDefinitionString();
            this.specificationtype = new SpecificationType();
            this.specobjecttype    = new SpecObjectType();
            this.specrelationtype  = new SpecRelationType();
            this.relationgrouptype = new RelationGroupType();

            this.specAttribute = new AttributeDefinitionString()
            {
                DatatypeDefinition = this.stringDatadef
            };

            this.reqAttribute = new AttributeDefinitionString()
            {
                DatatypeDefinition = this.stringDatadef
            };
            this.specRelationAttribute = new AttributeDefinitionString()
            {
                DatatypeDefinition = this.stringDatadef
            };
            this.relationgroupAttribute = new AttributeDefinitionString()
            {
                DatatypeDefinition = this.stringDatadef
            };

            this.specificationtype.SpecAttributes.Add(this.specAttribute);
            this.specobjecttype.SpecAttributes.Add(this.reqAttribute);
            this.specrelationtype.SpecAttributes.Add(this.specRelationAttribute);
            this.relationgrouptype.SpecAttributes.Add(this.relationgroupAttribute);

            this.specification1 = new Specification()
            {
                Type = this.specificationtype
            };
            this.specification2 = new Specification()
            {
                Type = this.specificationtype
            };

            this.specobject1 = new SpecObject()
            {
                Type = this.specobjecttype
            };
            this.specobject2 = new SpecObject()
            {
                Type = this.specobjecttype
            };

            this.specrelation = new SpecRelation()
            {
                Type = this.specrelationtype, Source = this.specobject1, Target = this.specobject2
            };
            this.relationgroup = new RelationGroup()
            {
                Type = this.relationgrouptype, SourceSpecification = this.specification1, TargetSpecification = this.specification2
            };

            this.specValue1 = new AttributeValueString()
            {
                AttributeDefinition = this.specAttribute, TheValue = "spec1"
            };
            this.specValue2 = new AttributeValueString()
            {
                AttributeDefinition = this.specAttribute, TheValue = "spec2"
            };
            this.objectValue1 = new AttributeValueString()
            {
                AttributeDefinition = this.reqAttribute, TheValue = "req1"
            };
            this.objectValue2 = new AttributeValueString()
            {
                AttributeDefinition = this.reqAttribute, TheValue = "req2"
            };
            this.relationgroupValue = new AttributeValueString()
            {
                AttributeDefinition = this.relationgroupAttribute, TheValue = "group"
            };
            this.specrelationValue = new AttributeValueString()
            {
                AttributeDefinition = this.specRelationAttribute, TheValue = "specrelation"
            };

            this.specification1.Values.Add(this.specValue1);
            this.specification2.Values.Add(this.specValue2);
            this.specobject1.Values.Add(this.objectValue1);
            this.specobject2.Values.Add(this.objectValue2);
            this.specrelation.Values.Add(this.specrelationValue);
            this.relationgroup.Values.Add(this.relationgroupValue);

            this.corecontent.DataTypes.Add(this.stringDatadef);
            this.corecontent.SpecTypes.AddRange(new SpecType[] { this.specobjecttype, this.specificationtype, this.specrelationtype, this.relationgrouptype });
            this.corecontent.SpecObjects.AddRange(new SpecObject[] { this.specobject1, this.specobject2 });
            this.corecontent.Specifications.AddRange(new Specification[] { this.specification1, this.specification2 });
            this.corecontent.SpecRelations.Add(this.specrelation);
            this.corecontent.SpecRelationGroups.Add(this.relationgroup);

            this.specification1.Children.Add(new SpecHierarchy()
            {
                Object = this.specobject1
            });
            this.specification2.Children.Add(new SpecHierarchy()
            {
                Object = this.specobject2
            });
        }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecRelationType"/> class.
 /// </summary>
 /// <param name="reqIfContent">
 /// The container <see cref="ReqIFContent"/>
 /// </param>
 internal SpecRelationType(ReqIFContent reqIfContent)
     : base(reqIfContent)
 {
 }
        public void Setup()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;
            this.session = new Mock <ISession>();
            this.dialogNavigationService      = new Mock <IDialogNavigationService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.permissionService            = new Mock <IPermissionService>();
            this.path = Path.Combine(TestContext.CurrentContext.TestDirectory, "ReqIf", "testreq.reqif");
            this.fileDialogService = new Mock <IOpenSaveFileDialogService>();
            this.fileDialogService.Setup(x => x.GetOpenFileDialog(true, true, false, It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), 1)).Returns(new string[] { this.path });
            this.reqIf = new ReqIF {
                Lang = "en"
            };
            this.reqIf.TheHeader = new ReqIFHeader()
            {
                Identifier = Guid.NewGuid().ToString()
            };
            var corecontent = new ReqIFContent();

            this.reqIf.CoreContent = corecontent;
            this.stringDatadef     = new DatatypeDefinitionString();
            this.spectype          = new SpecificationType();
            this.attribute         = new AttributeDefinitionString()
            {
                DatatypeDefinition = this.stringDatadef
            };

            this.spectype.SpecAttributes.Add(this.attribute);

            corecontent.DataTypes.Add(this.stringDatadef);

            this.settings = new RequirementsModuleSettings()
            {
                SavedConfigurations =
                {
                    new ImportMappingConfiguration()
                    {
                        ReqIfId = this.reqIf.TheHeader.Identifier, Name = "Test"
                    }
                }
            };

            this.pluginSettingService = new Mock <IPluginSettingsService>();
            this.pluginSettingService.Setup(x => x.Read <RequirementsModuleSettings>(true, It.IsAny <JsonConverter[]>())).Returns(this.settings);
            this.pluginSettingService.Setup(x => x.Read <RequirementsModuleSettings>(false)).Returns(this.settings);

            this.reqIfSerialiser = new Mock <IReqIFDeSerializer>();
            this.reqIfSerialiser.Setup(x => x.Deserialize(It.IsAny <string>(), It.IsAny <bool>(), null)).Returns(new[] { this.reqIf });
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);
            this.session.Setup(x => x.DataSourceUri).Returns(this.uri.ToString());
            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.dialog = new ReqIfImportDialogViewModel(new[] { this.session.Object }, new[] { this.iteration }, this.fileDialogService.Object, this.pluginSettingService.Object, this.reqIfSerialiser.Object);
            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.sitedir);
        }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecObjectType"/> class.
 /// </summary>
 /// <param name="reqIfContent">
 /// The container <see cref="ReqIFContent"/>
 /// </param>
 public SpecObjectType(ReqIFContent reqIfContent)
     : base(reqIfContent)
 {
 }
        public void Setup()
        {
            this.session = new Mock <ISession>();
            this.dialogNavigationService      = new Mock <IDialogNavigationService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.permissionService            = new Mock <IPermissionService>();
            this.pluginSettingsService        = new Mock <IPluginSettingsService>();
            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.session.Setup(x => x.Assembler).Returns(this.assembler);

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

            this.reqIf.CoreContent = 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);

            this.serviceLocator = new Mock <IServiceLocator>();
            this.serviceLocator.Setup(x => x.GetInstance <IPluginSettingsService>()).Returns(this.pluginSettingsService.Object);
            ServiceLocator.SetLocatorProvider(() => this.serviceLocator.Object);
        }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatatypeDefinition"/> class.
 /// </summary>
 /// <param name="reqIfContent">
 /// The owning <see cref="reqIfContent"/>
 /// </param>
 internal DatatypeDefinition(ReqIFContent reqIfContent)
 {
     this.ReqIFContent = reqIfContent;
     reqIfContent.DataTypes.Add(this);
 }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatatypeDefinitionSimple"/> class.
 /// </summary>
 /// <param name="reqIfContent">
 /// The owning <see cref="reqIfContent"/>
 /// </param>
 internal DatatypeDefinitionSimple(ReqIFContent reqIfContent)
     : base(reqIfContent)
 {
 }
        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);
        }
Пример #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RelationGroupType"/> class.
 /// </summary>
 /// <param name="reqIfContent">
 /// The container <see cref="ReqIFContent"/>
 /// </param>
 internal RelationGroupType(ReqIFContent reqIfContent)
     : base(reqIfContent)
 {
 }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatatypeDefinitionXHTML"/> class.
 /// </summary>
 /// <param name="reqIfContent">
 /// The owning <see cref="reqIfContent"/>
 /// </param>
 internal DatatypeDefinitionXHTML(ReqIFContent reqIfContent)
     : base(reqIfContent)
 {
     this.ReqIFContent = reqIfContent;
 }
Пример #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatatypeDefinitionBoolean"/> class.
 /// </summary>
 /// <param name="reqIfContent">
 /// The owning <see cref="reqIfContent"/>
 /// </param>
 internal DatatypeDefinitionBoolean(ReqIFContent reqIfContent)
     : base(reqIfContent)
 {
 }
Пример #24
0
        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.assembler.Cache.TryAdd(new CacheKey(this.sitedir.Iid, null), new Lazy <Thing>(() => this.sitedir));
            this.reqIf      = new ReqIF();
            this.reqIf.Lang = "en";
            var corecontent = new ReqIFContent();

            this.reqIf.CoreContent.Add(corecontent);
            this.stringDatadef = new DatatypeDefinitionString();
            this.spectype      = new RelationGroupType();
            this.attribute     = new AttributeDefinitionString()
            {
                DatatypeDefinition = this.stringDatadef
            };

            this.spectype.SpecAttributes.Add(this.attribute);

            corecontent.DataTypes.Add(this.stringDatadef);

            this.dialog = new RelationGroupTypeMappingDialogViewModel(new List <RelationGroupType> {
                this.spectype
            }, null, new Dictionary <DatatypeDefinition, DatatypeDefinitionMap> {
                { this.stringDatadef, new DatatypeDefinitionMap(this.stringDatadef, this.pt, null) }
            }, this.iteration, this.session.Object, this.thingDialogNavigationService.Object, "en");
            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.sitedir);
        }
 /// <summary>
 /// Initializes a new <see cref="ReqIfJsonConverter{T}"/>
 /// </summary>
 /// <param name="reqIf">The associated <see cref="ReqIF"/></param>
 /// <param name="session">The <see cref="ISession"/></param>
 protected ReqIfJsonConverter(ReqIF reqIf, ISession session)
 {
     this.ReqIfCoreContent = reqIf?.CoreContent;
     this.session          = session;
 }