예제 #1
0
        /// <summary>
        /// The syntax will also include all related concepts, referenced by the provided concept's members.
        /// </summary>
        public static DslSyntax CreateDslSyntax(params Type[] conceptInfoTypes)
        {
            var relatedConcepts          = GetAllRelatedConceptInfoTypes(conceptInfoTypes);
            var relatedConceptPrototypes = relatedConcepts.Select(c => (IConceptInfo)Activator.CreateInstance(c)).ToList();
            var syntax = new DslSyntaxFromPlugins(relatedConceptPrototypes, new BuildOptions(), new DatabaseSettings());

            return(syntax.CreateDslSyntax());
        }
예제 #2
0
        public void IncludeAbstractBaseClassWithoutPluginRegistration()
        {
            IEnumerable <IConceptInfo> registeredConceptsFromDependencyInjection = new[]
            {
                new ConcreteConcept()
            };

            var dslSyntaxFromPlugins = new DslSyntaxFromPlugins(
                registeredConceptsFromDependencyInjection,
                new BuildOptions(),
                new DatabaseSettings());

            var dslSyntax = dslSyntaxFromPlugins.CreateDslSyntax();

            var report = TestUtility.DumpSorted(
                dslSyntax.ConceptTypes,
                ct => $"{ct.TypeName} members:{TestUtility.DumpSorted(ct.Members, m => m.Name)}" +
                $" base:{TestUtility.DumpSorted(ct.BaseTypes, b => b.TypeName)}");

            Assert.AreEqual(
                "AbstractConcept members:Name base:, ConcreteConcept members:Name base:AbstractConcept",
                report);
        }