Пример #1
0
        public void ShouldOnlyAutoGenerateUnspecifiedTaggedValues()
        {
            ICctsRepository ccRepository = CctsRepositoryFactory.CreateCctsRepository(new CdtLibraryTestRepository());
            ICdtLibrary     cdtLibrary   = ccRepository.GetCdtLibraryByPath(CdtLibraryTestRepository.PathToCdtLibrary());

            CdtSpec cdtSpec = new CdtSpec {
                Name = "cdt1", UniqueIdentifier = "{x-123-456-789-x}", DictionaryEntryName = "shouldNotBeReplaced"
            };
            ICdt cdt = cdtLibrary.CreateCdt(cdtSpec);

            Assert.That(cdt.UniqueIdentifier, Is.EqualTo("{x-123-456-789-x}"));
            Assert.That(cdt.DictionaryEntryName, Is.EqualTo("shouldNotBeReplaced"));
        }
Пример #2
0
        public void ShouldAutoGenerateTaggedValues()
        {
            ICctsRepository ccRepository = CctsRepositoryFactory.CreateCctsRepository(new CdtLibraryTestRepository());
            ICdtLibrary     cdtLibrary   = ccRepository.GetCdtLibraryByPath(CdtLibraryTestRepository.PathToCdtLibrary());

            CdtSpec cdtSpec = new CdtSpec {
                Name = "cdt1"
            };
            ICdt cdt = cdtLibrary.CreateCdt(cdtSpec);

            Assert.That(cdt.UniqueIdentifier, Is.Not.Null);
            Assert.That(cdt.UniqueIdentifier, Is.Not.Empty);
            Assert.That(cdt.DictionaryEntryName, Is.EqualTo("cdt1. Type"));
        }
Пример #3
0
 public static CdtLibrarySpec CloneCdtLibrary(ICdtLibrary cdtLibrary)
 {
     return(new CdtLibrarySpec
     {
         Name = cdtLibrary.Name,
         BusinessTerms = new List <string>(cdtLibrary.BusinessTerms),
         Copyrights = new List <string>(cdtLibrary.Copyrights),
         Owners = new List <string>(cdtLibrary.Owners),
         References = new List <string>(cdtLibrary.References),
         Status = cdtLibrary.Status,
         VersionIdentifier = cdtLibrary.VersionIdentifier,
         BaseURN = cdtLibrary.BaseURN,
         NamespacePrefix = cdtLibrary.NamespacePrefix,
     });
 }
Пример #4
0
        public void ShouldNotAutoGenerateSpecifiedTaggedValues()
        {
            ICctsRepository ccRepository = CctsRepositoryFactory.CreateCctsRepository(new CdtLibraryTestRepository());
            ICdtLibrary     cdtLibrary   = ccRepository.GetCdtLibraryByPath(CdtLibraryTestRepository.PathToCdtLibrary());

            ICdt cdtText = ccRepository.GetCdtByPath(CdtLibraryTestRepository.PathToCdtText());

            CdtSpec cdtSpec = CdtSpec.CloneCdt(cdtText);

            cdtSpec.DictionaryEntryName = "cdt1";
            cdtSpec.UniqueIdentifier    = "{1-2-3}";

            ICdt updatedCdt = cdtLibrary.UpdateCdt(cdtText, cdtSpec);

            Assert.That(updatedCdt.UniqueIdentifier, Is.EqualTo("{1-2-3}"));
            Assert.That(updatedCdt.DictionaryEntryName, Is.EqualTo("cdt1"));
        }
        public void ShouldAutoGenerateClonedTaggedValues()
        {
            ICctsRepository ccRepository = CreateRepository();
            ICdtLibrary     cdtLibrary   = ccRepository.GetCdtLibraryByPath(CdtLibraryTestRepository.PathToCdtLibrary());
            ICdt            cdtText      = ccRepository.GetCdtByPath(CdtLibraryTestRepository.PathToCdtText());

            CdtSpec cdtSpec = CdtSpec.CloneCdt(cdtText);

            cdtSpec.Name = "cdt1";

            ICdt cdt = cdtLibrary.CreateCdt(cdtSpec);

            Assert.That(cdt.UniqueIdentifier, Is.Not.Null);
            Assert.That(cdt.UniqueIdentifier, Is.Not.Empty);
            Assert.That(cdt.UniqueIdentifier, Is.Not.EqualTo(cdtText.UniqueIdentifier));
            Assert.That(cdt.DictionaryEntryName, Is.EqualTo("cdt1. Type"));
        }
        public void ShouldNotUpdateAutoGeneratedTaggedValues()
        {
            ICctsRepository ccRepository = CreateRepository();
            ICdtLibrary     cdtLibrary   = ccRepository.GetCdtLibraryByPath(CdtLibraryTestRepository.PathToCdtLibrary());

            ICdt   cdtText = ccRepository.GetCdtByPath(CdtLibraryTestRepository.PathToCdtText());
            string cdtTextUniqueIdentifier    = cdtText.UniqueIdentifier;
            string cdtTextDictionaryEntryName = cdtText.DictionaryEntryName;

            CdtSpec cdtSpec = CdtSpec.CloneCdt(cdtText);

            cdtSpec.Name = "cdt1";

            ICdt updatedCdt = cdtLibrary.UpdateCdt(cdtText, cdtSpec);

            Assert.That(updatedCdt.UniqueIdentifier, Is.EqualTo(cdtTextUniqueIdentifier));
            Assert.That(updatedCdt.DictionaryEntryName, Is.EqualTo(cdtTextDictionaryEntryName));
        }
Пример #7
0
        public void LoadCDTs(ICctsRepository repository)
        {
            if (CDTs.Count == 0)
            {
                ICdtLibrary cdtl = repository.GetCdtLibraryById(Id);

                foreach (ICdt cdt in cdtl.Cdts)
                {
                    if (CDTs.ContainsKey(cdt.Name))
                    {
                        CDTs.Clear();
                        throw new CacheException("The wizard encountered two CDTs within one CDT library having identical names. Please verify your model!");
                    }

                    CDTs.Add(cdt.Name, new cCDT(cdt.Name, cdt.Id));
                }

                if (CDTs.Count == 0)
                {
                    throw new CacheException(
                              "The CC library did not contain any CDTs. Please make sure at least one CDT is present in the library before proceeding with the wizard.");
                }
            }
        }
Пример #8
0
 internal CacheItemCdtLibrary(ICdtLibrary library)
 {
     CdtLibrary = library;
 }
Пример #9
0
 public void RemoveCdtLibrary(ICdtLibrary cdtLibrary)
 {
     throw new NotImplementedException();
 }
Пример #10
0
 public ICdtLibrary UpdateCdtLibrary(ICdtLibrary cdtLibrary, CdtLibrarySpec specification)
 {
     throw new NotImplementedException();
 }
Пример #11
0
 public CandidateCdtLibrary(ICdtLibrary originalCdtLibrary)
 {
     mOriginalCdtLibrary = originalCdtLibrary;
     mSelected           = false;
     mCandidateCdts      = null;
 }
 /// <summary>
 /// Removes a CdtLibrary from this bLibrary.
 /// <param name="cdtLibrary">A CdtLibrary.</param>
 /// </summary>
 public void RemoveCdtLibrary(ICdtLibrary cdtLibrary)
 {
     UmlPackage.RemovePackage(((UpccCdtLibrary)cdtLibrary).UmlPackage);
 }
 /// <summary>
 /// Updates a CDTLibrary to match the given <paramref name="specification"/>.
 /// <param name="cdtLibrary">A CDTLibrary.</param>
 /// <param name="specification">A new specification for the given CDTLibrary.</param>
 /// <returns>The updated CDTLibrary. Depending on the implementation, this might be the same updated instance or a new instance!</returns>
 /// </summary>
 public ICdtLibrary UpdateCdtLibrary(ICdtLibrary cdtLibrary, CdtLibrarySpec specification)
 {
     return(new UpccCdtLibrary(UmlPackage.UpdatePackage(((UpccCdtLibrary)cdtLibrary).UmlPackage, CdtLibrarySpecConverter.Convert(specification))));
 }