public EARepository2() { this.AddModel("test model", m => m.AddPackage("bLibrary", bLibrary => { bLibrary.Element.Stereotype = Stereotype.bLibrary; bLibrary.AddTaggedValue(TaggedValues.baseURN.ToString()).WithValue("urn:test:blib1"); bLibrary.AddPackage("PRIMLibrary", InitPRIMLibrary); bLibrary.AddPackage("ENUMLibrary", InitENUMLibrary); bLibrary.AddPackage("CDTLibrary", InitCDTLibrary); bLibrary.AddPackage("BDTLibrary", InitBDTLibrary); bLibrary.AddPackage("CCLibrary", InitCCLibrary); bLibrary.AddPackage("BIELibrary", InitBIELibrary); bLibrary.AddPackage("DOCLibrary", InitDOCLibrary); })); bdtSimpleString.AddBasedOnDependency(cdtSimpleString); bdtCurrency.AddBasedOnDependency(cdtCurrency); bdtMeasure.AddBasedOnDependency(cdtMeasure); bdtCode.AddBasedOnDependency(cdtCode); bdtDate.AddBasedOnDependency(cdtDate); bdtText.AddBasedOnDependency(cdtText); abieAddress.AddBasedOnDependency(accAddress); accPerson.AddASCC(accAddress, "homeAddress"); accPerson.AddASCC(accAddress, "workAddress", "0", "*"); abiePerson.AddASBIE(abieAddress, "homeAddress", EaAggregationKind.Shared); abiePerson.AddASBIE(abieAddress, "workAddress", EaAggregationKind.Composite, "0", "*"); abieInvoice.AddASBIE(abieInvoiceInfo, "info", EaAggregationKind.Shared); abieInvoiceInfo.AddASBIE(abieAddress, "deliveryAddress", EaAggregationKind.Shared); }
public EARepositoryAbieEditor() { this.AddModel("test model", InitTestModel); bdtMeasure.AddBasedOnDependency(cdtMeasure); bdtCode.AddBasedOnDependency(cdtCode); bdtABCCode.AddBasedOnDependency(cdtCode); bdtDate.AddBasedOnDependency(cdtDate); bdtText.AddBasedOnDependency(cdtText); bieMyAddress.AddBasedOnDependency(accAddress); accPerson.AddASCC(accAddress, "homeAddress"); accPerson.AddASCC(accAddress, "workAddress", "0", "*"); bieMyPerson.AddASBIE(bieMyAddress, "homeAddress", EaAggregationKind.Shared); bieMyPerson.AddBasedOnDependency(accPerson); bieMyPerson.AddASBIE(bieMyAddress, "workAddress", EaAggregationKind.Composite, "0", "*"); bieInvoice.AddASBIE(bieInvoiceInfo, "info", EaAggregationKind.Shared); bieInvoiceInfo.AddASBIE(bieMyAddress, "deliveryAddress", EaAggregationKind.Shared); }
public SynchTaggedValuesTestRepository() { Element prim = null; Element acc = null; Element abie = null; Package model = this.AddModel("Model", m => { }); Package bLibrary = model.AddPackage( "bLibrary", bLib => { bLib.Element.Stereotype = Stereotype.bLibrary; } ); bLibrary.AddPackage("PRIMLibrary", primLib => { primLib.Element.Stereotype = Stereotype.PRIMLibrary; prim = primLib.AddPRIM("PRIM"); }); bLibrary.AddPackage("ENUMLibrary", enumLib => { enumLib.Element.Stereotype = Stereotype.ENUMLibrary; Element @enum = enumLib.AddENUM("ENUM", prim); @enum.AddAttribute("CodelistEntry", "string").With(a => a.Stereotype = Stereotype.CodelistEntry); enumLib.AddClass("IDSCHEME").With(c => c.Stereotype = Stereotype.IDSCHEME); }); bLibrary.AddPackage("CDTLibrary", cdtLib => { cdtLib.Element.Stereotype = Stereotype.CDTLibrary; Element cdt = cdtLib.AddCDT("CDT"); cdt.AddAttribute("CON", prim).With((a => a.Stereotype = Stereotype.CON)); cdt.AddSUP(prim, "SUP"); }); bLibrary.AddPackage("CCLibrary", ccLib => { ccLib.Element.Stereotype = Stereotype.CCLibrary; acc = ccLib.AddACC("ACC"); acc.AddBCC(prim, "BCC"); }); bLibrary.AddPackage("BDTLibrary", bdtLib => { bdtLib.Element.Stereotype = Stereotype.BDTLibrary; Element bdt = bdtLib.AddBDT("BDT"); bdt.AddAttribute("CON", prim).With((a => a.Stereotype = Stereotype.CON)); bdt.AddSUP(prim, "SUP"); }); bLibrary.AddPackage("BIELibrary", bieLib => { bieLib.Element.Stereotype = Stereotype.BIELibrary; abie = bieLib.AddABIE("ABIE"); abie.AddBBIE(prim, "BBIE"); }); bLibrary.AddPackage("DOCLibrary", bieLib => { bieLib.Element.Stereotype = Stereotype.DOCLibrary; }); acc.AddASCC(acc, "ASCC"); abie.AddASBIE(abie, "ASBIE", EaAggregationKind.Shared); }
public void Test_calculate_remaining_xsd_types_from_document_model_with_cycle() { EARepository eaRepository = new EARepository(); Element bdtStringText = null; Element primString = null; Element abiePersonTypePerson = null; Element abiePersonTypeNote = null; #region EA Repository Subset eaRepository.AddModel( "Test Model Subset", m => m.AddPackage("bLibrary", bLibrary => { bLibrary.Element.Stereotype = Stereotype.bLibrary; bLibrary.AddPackage("PRIMLibrary", package => { package.Element.Stereotype = Stereotype.PRIMLibrary; primString = package.AddPRIM("String"); }); bLibrary.AddPackage("BDTLibrary", package => { package.Element.Stereotype = Stereotype.BDTLibrary; bdtStringText = package.AddBDT("String_Text").With(e => { e.Stereotype = Stereotype.BDT; e.AddCON(primString); }); }); bLibrary.AddPackage("BIELibrary", package => { package.Element.Stereotype = Stereotype.BIELibrary; Element abieAddressTypeAddress = package.AddClass("AddressType_Address").With(e => { e.Stereotype = Stereotype.ABIE; e.AddBBIE(bdtStringText, "City_CityName"); }); abiePersonTypePerson = package.AddClass("PersonType_Person").With(e => { e.Stereotype = Stereotype.ABIE; e.AddBBIE(bdtStringText, "Name_Name"); e.AddASBIE(abieAddressTypeAddress, "Address_Residence", EaAggregationKind.Composite); }); abiePersonTypePerson.AddASBIE(abiePersonTypePerson, "Child_Child", EaAggregationKind.Shared); abiePersonTypeNote = package.AddClass("PersonType_Note").With(e => { e.Stereotype = Stereotype.ABIE; }); }); bLibrary.AddPackage("DOCLibrary", package => { package.Element.Stereotype = Stereotype.DOCLibrary; Element maPersonType = package.AddClass("PersonType").With(e => { e.Stereotype = Stereotype.MA; e.AddASMA(abiePersonTypePerson, "Person"); e.AddASMA(abiePersonTypeNote, "Note"); }); Element maPassportType = package.AddClass("PassportType").With(e => { e.Stereotype = Stereotype.MA; e.AddASMA(maPersonType, "Person"); }); package.AddClass("Austrian_Passport").With(e => { e.Stereotype = Stereotype.MA; e.AddASMA(maPassportType, "Passport"); }); }); })); #endregion ICctsRepository cctsRepository = CctsRepositoryFactory.CreateCctsRepository(eaRepository); IDocLibrary docLibrarySubset = cctsRepository.GetDocLibraryByPath((Path)"Test Model Subset" / "bLibrary" / "DOCLibrary"); UpccModelXsdTypes existingXsdTypes = new UpccModelXsdTypes(docLibrarySubset); // Positive Assertions Assert.That(existingXsdTypes.Count, Is.EqualTo(4)); Assert.That(existingXsdTypes.ContainsXsdType("String"), Is.True); Assert.That(existingXsdTypes.ContainsXsdType("AddressType"), Is.True); Assert.That(existingXsdTypes.ContainsXsdType("PersonType"), Is.True); Assert.That(existingXsdTypes.ContainsXsdType("PassportType"), Is.True); Assert.That(existingXsdTypes.NumberOfChildren("String"), Is.EqualTo(0)); Assert.That(existingXsdTypes.NumberOfChildren("AddressType"), Is.EqualTo(1)); Assert.That(existingXsdTypes.NumberOfChildren("PersonType"), Is.EqualTo(3)); Assert.That(existingXsdTypes.NumberOfChildren("PassportType"), Is.EqualTo(1)); Assert.That(existingXsdTypes.XsdTypeContainsChild("AddressType", "City"), Is.True); Assert.That(existingXsdTypes.XsdTypeContainsChild("PersonType", "Name"), Is.True); Assert.That(existingXsdTypes.XsdTypeContainsChild("PersonType", "Address"), Is.True); Assert.That(existingXsdTypes.XsdTypeContainsChild("PersonType", "Child"), Is.True); Assert.That(existingXsdTypes.XsdTypeContainsChild("PassportType", "Person"), Is.True); //Negative Assertions Assert.That(existingXsdTypes.ContainsXsdType("SuperDooperNonExistingType"), Is.False); Assert.That(existingXsdTypes.NumberOfChildren("SuperDooperNonExistingType"), Is.EqualTo(0)); Assert.That(existingXsdTypes.XsdTypeContainsChild("AddressType", "NonExistingChild"), Is.False); }