private IBdtLibrary ShouldContainBdtLibrary(string bdtLibraryName)
        {
            var library = cctsRepository.GetBdtLibraryByPath((Path)"test" / "bLibrary" / bdtLibraryName);

            Assert.That(library, Is.Not.Null, "BDTLibrary '" + bdtLibraryName + "' not generated");
            return(library);
        }
        public void ShouldPrepareTemporaryBdtModelandCreateBdt()
        {
            const string selectedCdtLibrary = "cdtlib1";
            const string selectedCdt        = "Code";
            const bool   checkedValue       = true;

            target.setSelectedCandidateCdtLibrary(selectedCdtLibrary);
            target.setSelectedCandidateCdt(selectedCdt);
            target.setCheckedAllPotentialSups(checkedValue);
            target.Prefix = "MyPrefix";
            target.Name   = "MyName";
            target.setSelectedCandidateBdtLibrary("bdtlib1");

            target.CreateBdt();
            var testsuccess = false;

            foreach (IBdt bdt in cctsRepository.GetBdtLibraryByPath((Path)"test model" / "blib1" / "bdtlib1").Bdts)
            {
                if (bdt.Name.Equals("MyPrefixMyName"))
                {
                    testsuccess = true;
                }
            }
            Assert.IsTrue(testsuccess);
        }
Пример #3
0
        private static IImporterContext CreateContext(string testCase)
        {
            XmlSchema bdtSchema = XmlSchema.Read(XmlReader.Create(TestUtils.RelativePathToTestResource(typeof(BDTXsdImporterTests), string.Format(@"BDTImporterTestResources\BusinessDataType_{0}.xsd", testCase))), null);

            var eaRepository = new EARepository();

            eaRepository.AddModel("Model", m => m.AddPackage("bLibrary", bLibrary =>
            {
                bLibrary.Element.Stereotype = Stereotype.bLibrary;
                bLibrary.AddPackage("PRIMLibrary", primLib =>
                {
                    primLib.Element.Stereotype = Stereotype.PRIMLibrary;
                    primLib.AddPRIM("String");
                    primLib.AddPRIM("Decimal");
                    primLib.AddPRIM("Date");
                });
                bLibrary.AddPackage("CDTLibrary", cdtLib =>
                {
                    cdtLib.Element.Stereotype = Stereotype.CDTLibrary;
                    cdtLib.AddCDT("Text");
                });
                bLibrary.AddPackage("BDTLibrary", bdtLib => { bdtLib.Element.Stereotype = Stereotype.BDTLibrary; });
            }));
            ICctsRepository cctsRepository = CctsRepositoryFactory.CreateCctsRepository(eaRepository);
            var             primLibrary    = cctsRepository.GetPrimLibraryByPath((Path)"Model" / "bLibrary" / "PRIMLibrary");
            var             bdtLibrary     = cctsRepository.GetBdtLibraryByPath((Path)"Model" / "bLibrary" / "BDTLibrary");
            var             cdtLibrary     = cctsRepository.GetCdtLibraryByPath((Path)"Model" / "bLibrary" / "CDTLibrary");

            var contextMock = new Mock <IImporterContext>();

            contextMock.SetupGet(c => c.PRIMLibrary).Returns(primLibrary);
            contextMock.SetupGet(c => c.CDTLibrary).Returns(cdtLibrary);
            contextMock.SetupGet(c => c.BDTLibrary).Returns(bdtLibrary);
            contextMock.SetupGet(c => c.BDTSchema).Returns(bdtSchema);

            return(contextMock.Object);
        }