Esempio n. 1
0
        /// <summary>
        /// Returns a <see cref="SpecObjectType"/> associated to a <see cref="RequirementsGroup"/> and a set of rules
        /// </summary>
        /// <param name="group">The <see cref="RequirementsGroup"/></param>
        /// <param name="appliedRules">The set of <see cref="ParameterizedCategoryRule"/></param>
        /// <param name="parameterTypeMap">The map of <see cref="ParameterType"/> to <see cref="DatatypeDefinition"/></param>
        /// <returns>The <see cref="SpecObjectType"/></returns>
        public SpecObjectType ToReqIfSpecObjectType(RequirementsGroup group, IReadOnlyCollection <ParameterizedCategoryRule> appliedRules, IReadOnlyDictionary <ParameterType, DatatypeDefinition> parameterTypeMap)
        {
            if (group == null)
            {
                throw new ArgumentNullException("group");
            }

            var specObjectType = new SpecObjectType
            {
                Identifier  = Guid.NewGuid().ToString(),
                LongName    = GroupNamePrefix + (appliedRules.Any() ? string.Join(", ", appliedRules.Select(r => r.ShortName)) : group.ClassKind.ToString()),
                LastChange  = DateTime.UtcNow,
                Description = appliedRules.Any() ? string.Join(", ", appliedRules.Select(r => r.Name)) : group.ClassKind.ToString()
            };

            this.AddCommonAttributeDefinition(specObjectType);

            var parameterTypes = appliedRules.SelectMany(r => r.ParameterType).Distinct();

            foreach (var parameterType in parameterTypes)
            {
                var attibuteDef = this.ToReqIfAttributeDefinition(parameterType, parameterTypeMap);
                specObjectType.SpecAttributes.Add(attibuteDef);
            }

            return(specObjectType);
        }
        public void VerifyThatUnkownElementAttributeDefinitionThrowsArgumentException()
        {
            var spectType = new SpecObjectType();

            string unknownName = "RHEA";

            Assert.IsNull(ReqIfFactory.AttributeDefinitionConstruct(unknownName, spectType));
        }
Esempio n. 3
0
        public void Verify_That_Unkown_Element_AttributeDefinition_Throws_ArgumentException()
        {
            var spectType = new SpecObjectType();

            string unknownName = "RHEA";

            Assert.IsNull(ReqIfFactory.AttributeDefinitionConstruct(unknownName, spectType, this.loggerFactory));
        }
        public void Verify_that_when_specType_is_not_SpecificationType_an_exception_is_thrown()
        {
            var specObjectType = new SpecObjectType();

            var specification = new Specification();

            Assert.Throws <ArgumentException>(() => specification.SpecType = specObjectType);
        }
        public void VerifyThatXmlElementNameReturnsAttributeDefinition()
        {
            var spectType = new SpecObjectType();

            Assert.IsInstanceOf <AttributeDefinitionBoolean>(ReqIfFactory.AttributeDefinitionConstruct("ATTRIBUTE-DEFINITION-BOOLEAN", spectType));
            Assert.IsInstanceOf <AttributeDefinitionDate>(ReqIfFactory.AttributeDefinitionConstruct("ATTRIBUTE-DEFINITION-DATE", spectType));
            Assert.IsInstanceOf <AttributeDefinitionEnumeration>(ReqIfFactory.AttributeDefinitionConstruct("ATTRIBUTE-DEFINITION-ENUMERATION", spectType));
            Assert.IsInstanceOf <AttributeDefinitionInteger>(ReqIfFactory.AttributeDefinitionConstruct("ATTRIBUTE-DEFINITION-INTEGER", spectType));
            Assert.IsInstanceOf <AttributeDefinitionReal>(ReqIfFactory.AttributeDefinitionConstruct("ATTRIBUTE-DEFINITION-REAL", spectType));
            Assert.IsInstanceOf <AttributeDefinitionString>(ReqIfFactory.AttributeDefinitionConstruct("ATTRIBUTE-DEFINITION-STRING", spectType));
            Assert.IsInstanceOf <AttributeDefinitionXHTML>(ReqIfFactory.AttributeDefinitionConstruct("ATTRIBUTE-DEFINITION-XHTML", spectType));
        }
Esempio n. 6
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));
        }
Esempio n. 7
0
        /// <summary>
        /// Returns the <see cref="SpecObjectType"/> corresponding to a <see cref="Requirement"/>
        /// </summary>
        /// <param name="requirement">The <see cref="Requirement"/></param>
        /// <param name="appliedRules">The applied <see cref="ParameterizedCategoryRule"/></param>
        /// <param name="parameterTypeMap">The map of <see cref="ParameterType"/> to <see cref="DatatypeDefinition"/></param>
        /// <returns>the <see cref="SpecObjectType"/></returns>
        public SpecObjectType ToReqIfSpecObjectType(Requirement requirement, IReadOnlyCollection <ParameterizedCategoryRule> appliedRules, IReadOnlyDictionary <ParameterType, DatatypeDefinition> parameterTypeMap)
        {
            if (requirement == null)
            {
                throw new ArgumentNullException("requirement");
            }

            var specObjectType = new SpecObjectType()
            {
                Identifier  = Guid.NewGuid().ToString(),
                LongName    = appliedRules.Any() ? string.Join(", ", appliedRules.Select(r => r.ShortName)) : requirement.ClassKind.ToString(),
                LastChange  = DateTime.UtcNow,
                Description = appliedRules.Any() ? string.Join(", ", appliedRules.Select(r => r.Name)) : requirement.ClassKind.ToString()
            };

            this.AddCommonAttributeDefinition(specObjectType);

            var requirementAttDefinition = new AttributeDefinitionString
            {
                LongName    = RequirementTextAttributeDefName,
                LastChange  = DateTime.UtcNow,
                Description = "The Requirement Text Attribute Definition",
                Identifier  = Guid.NewGuid().ToString(),
                Type        = this.TextDatatypeDefinition
            };

            specObjectType.SpecAttributes.Add(requirementAttDefinition);

            var isDeprecatedAttributeDefinition = new AttributeDefinitionBoolean()
            {
                LongName    = IsDeprecatedAttributeDefName,
                LastChange  = DateTime.Now,
                Description = "The IsDeprecated Attribute Definition",
                Identifier  = Guid.NewGuid().ToString(),
                Type        = this.BooleanDatatypeDefinition
            };

            specObjectType.SpecAttributes.Add(isDeprecatedAttributeDefinition);

            // set the attribute-definition
            var parameterTypes            = appliedRules.SelectMany(r => r.ParameterType).ToList();
            var requirementParameterTypes = requirement.ParameterValue.Select(spv => spv.ParameterType);

            parameterTypes.AddRange(requirementParameterTypes);

            foreach (var parameterType in parameterTypes.Distinct())
            {
                var attibuteDef = this.ToReqIfAttributeDefinition(parameterType, parameterTypeMap);
                specObjectType.SpecAttributes.Add(attibuteDef);
            }

            return(specObjectType);
        }
Esempio n. 8
0
        /// <summary>
        /// Returns the <see cref="SpecObject"/> representation of a <see cref="Requirement"/>
        /// </summary>
        /// <param name="requirement">The <see cref="Requirement"/></param>
        /// <param name="specObjectType">The associated <see cref="SpecObjectType"/></param>
        /// <returns>The associated <see cref="SpecObject"/></returns>
        public SpecObject ToReqIfSpecObject(Requirement requirement, SpecObjectType specObjectType)
        {
            if (requirement == null)
            {
                throw new ArgumentNullException("requirement");
            }

            var specObject = new SpecObject();

            this.SetIdentifiableProperties(specObject, requirement);
            specObject.Type = specObjectType;

            this.SetCommonAttributeValues(specObject, requirement);

            foreach (var parameterValue in requirement.ParameterValue)
            {
                var attributeDef = specObjectType.SpecAttributes.Single(x => x.DatatypeDefinition.Identifier == parameterValue.ParameterType.Iid.ToString());
                var value        = this.ToReqIfAttributeValue(parameterValue.ParameterType, attributeDef, parameterValue.Value, parameterValue.Scale);
                specObject.Values.Add(value);
            }

            // Add extra AttributeValue corresponding to the requirement text
            if (requirement.Definition.Any())
            {
                var definition          = requirement.Definition.First();
                var attributeDefinition = (AttributeDefinitionString)specObjectType.SpecAttributes.Single(def => def.DatatypeDefinition == this.TextDatatypeDefinition && def.LongName == RequirementTextAttributeDefName);
                var requirementValue    = new AttributeValueString
                {
                    TheValue   = definition.Content,
                    Definition = attributeDefinition
                };

                specObject.Values.Add(requirementValue);
            }

            // Add extra AttributeValue corresponding to the isDeprecated property
            var isDeprecatedType = (AttributeDefinitionBoolean)specObjectType.SpecAttributes.Single(def => def.DatatypeDefinition == this.BooleanDatatypeDefinition && def.LongName == IsDeprecatedAttributeDefName);
            var isDeprecated     = new AttributeValueBoolean
            {
                TheValue   = requirement.IsDeprecated,
                Definition = isDeprecatedType
            };

            specObject.Values.Add(isDeprecated);

            return(specObject);
        }
Esempio n. 9
0
        public void VerifyThatTheSpecTypeCanBeSetOrGet()
        {
            var specObjectType = new SpecObjectType();

            var spectObject = new SpecObject();

            spectObject.Type = specObjectType;

            var specElementWithAttributes = (SpecElementWithAttributes)spectObject;

            Assert.AreEqual(specObjectType, specElementWithAttributes.SpecType);

            var otherSpecObjectType = new SpecObjectType();

            specElementWithAttributes.SpecType = otherSpecObjectType;

            Assert.AreEqual(otherSpecObjectType, spectObject.SpecType);
        }
Esempio n. 10
0
        /// <summary>
        /// Returns the <see cref="SpecObject"/> representation of a <see cref="RequirementsGroup"/>
        /// </summary>
        /// <param name="requirementsGroup">The <see cref="RequirementsGroup"/></param>
        /// <param name="specObjectType">The associated <see cref="SpecObjectType"/></param>
        /// <returns>The associated <see cref="SpecObject"/></returns>
        public SpecObject ToReqIfSpecObject(RequirementsGroup requirementsGroup, SpecObjectType specObjectType)
        {
            if (requirementsGroup == null)
            {
                throw new ArgumentNullException("requirementsGroup");
            }

            var specObject = new SpecObject();

            this.SetIdentifiableProperties(specObject, requirementsGroup);
            specObject.Type = specObjectType;

            this.SetCommonAttributeValues(specObject, requirementsGroup);

            foreach (var parameterValue in requirementsGroup.ParameterValue)
            {
                var attributeDef = specObjectType.SpecAttributes.Single(x => x.DatatypeDefinition.Identifier == parameterValue.ParameterType.Iid.ToString());
                var value        = this.ToReqIfAttributeValue(parameterValue.ParameterType, attributeDef, parameterValue.Value, parameterValue.Scale);
                specObject.Values.Add(value);
            }

            return(specObject);
        }
        public override void ProcessElementStartNode(string name)
        {
            switch (name)
            {
            case specificationTypeNodeName:
                identifiableElementUnderConstruction = new SpecificationType();
                break;

            case specObjectTypeNodeName:
                identifiableElementUnderConstruction = new SpecObjectType();
                break;

            case specRelationTypeNodeName:
                identifiableElementUnderConstruction = new SpecRelationType();
                break;

            case relationGroupTypeNodeName:
                identifiableElementUnderConstruction = new RelationGroupType();
                break;

            default:
                throw new ParserFailureException(unexpectedElementNodeErrorText + name + "'.");
            }
        }
        public override void ProcessElementStartNode(string name)
        {
            switch (name)
            {
                case specificationTypeNodeName:
                    identifiableElementUnderConstruction = new SpecificationType();
                    break;

                case specObjectTypeNodeName:
                    identifiableElementUnderConstruction = new SpecObjectType();
                    break;

                case specRelationTypeNodeName:
                    identifiableElementUnderConstruction = new SpecRelationType();
                    break;

                case relationGroupTypeNodeName:
                    identifiableElementUnderConstruction = new RelationGroupType();
                    break;

                default:
                    throw new ParserFailureException(unexpectedElementNodeErrorText + name + "'.");
            }
        }
Esempio n. 13
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.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);
        }
Esempio n. 14
0
        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 }
            };
        }
        /// <summary>
        /// create a <see cref="SpecObjectType"/> with attribute definitions
        /// </summary>
        private void CreateSpecObjectType()
        {
            var reqIfContent = this.reqIF.CoreContent.SingleOrDefault();

            var specObjectType = new SpecObjectType();

            specObjectType.LongName   = "Requirement Type";
            specObjectType.Identifier = "requirement";
            specObjectType.LastChange = DateTime.Parse("2015-12-01");

            var attributeDefinitionBoolean = new AttributeDefinitionBoolean();

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

            var attributeDefinitionDate = new AttributeDefinitionDate();

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

            var attributeDefinitionEnumeration = new AttributeDefinitionEnumeration();

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

            var attributeDefinitionInteger = new AttributeDefinitionInteger();

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

            var attributeDefinitionReal = new AttributeDefinitionReal();

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

            var attributeDefinitionString = new AttributeDefinitionString();

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

            var attributeDefinitionXhtml = new AttributeDefinitionXHTML();

            attributeDefinitionXhtml.LongName   = "xhtml attribute";
            attributeDefinitionXhtml.Identifier = "requirement-xhtml-attribute";
            attributeDefinitionXhtml.LastChange = DateTime.Parse("2015-12-01");
            attributeDefinitionXhtml.Type       = (DatatypeDefinitionXHTML)reqIfContent.DataTypes.SingleOrDefault(x => x.GetType() == typeof(DatatypeDefinitionXHTML));
            specObjectType.SpecAttributes.Add(attributeDefinitionXhtml);

            reqIfContent.SpecTypes.Add(specObjectType);
        }
        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
            });
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpecObjectTypeMap"/> class
 /// </summary>
 /// <param name="specType">The <see cref="SpecObjectType"/></param>
 /// <param name="rules">The <see cref="ParameterizedCategoryRule"/> associated</param>
 /// <param name="categories">The <see cref="Category"/> associated</param>
 /// <param name="attributeDefMap">The <see cref="AttributeDefinitionMap"/>s for this <see cref="SpecType"/></param>
 /// <param name="isRequirement">A value indicating if the <see cref="SpecObjectType"/> is a requirement object type</param>
 public SpecObjectTypeMap(SpecObjectType specType, IEnumerable <ParameterizedCategoryRule> rules, IEnumerable <Category> categories, IEnumerable <AttributeDefinitionMap> attributeDefMap, bool isRequirement)
     : base(specType, rules, categories, attributeDefMap)
 {
     this.IsRequirement = isRequirement;
 }