Exemplo n.º 1
0
        private SeedBucketInfo CreateSeedBucketInfo(TSeedBucketImplementation implementation)
        {
            Type?  type               = typeExtractor.ExtractFrom(implementation);
            string fullName           = fullNameExtractor.ExtractFrom(implementation);
            string friendlyName       = friendlyNameExtractor.ExtractFrom(implementation);
            string description        = descriptionExtractor.ExtractFrom(implementation);
            var    containedSeedables = seedablesExtractor.ExtractFrom(implementation);

            SetSeedBucketInfosForNonContainedSeedables();

            return(new SeedBucketInfo
                   (
                       implementation,
                       type,
                       fullName,
                       friendlyName,
                       description,
                       containedSeedables,
                       Array.Empty <Error>()
                   ));

            void SetSeedBucketInfosForNonContainedSeedables()
            {
                foreach (var nonContainedSeedable in SeedableInfo.GetRequiredSeedableInfosNotContainedIn(containedSeedables))
                {
                    nonContainedSeedable.SeedBucket = seedBucketOfSeedableExtractor.ExtractFrom((TSeedableImplementation)nonContainedSeedable.Implementation);
                }
            }
        }
Exemplo n.º 2
0
        SeedBucketStartupInfo IMetaInfoBuilder <TSeedBucketStartupImplementation, SeedBucketStartupInfo> .BuildFrom(TSeedBucketStartupImplementation implementation)
        {
            Type?  type         = typeExtractor.ExtractFrom(implementation);
            string fullName     = fullNameExtractor.ExtractFrom(implementation);
            string friendlyName = friendlyNameExtractor.ExtractFrom(implementation);
            string description  = descriptionExtractor.ExtractFrom(implementation);

            return(new SeedBucketStartupInfo
                   (
                       implementation,
                       type,
                       fullName,
                       friendlyName,
                       description,
                       Array.Empty <Error>()
                   ));
        }
Exemplo n.º 3
0
        private SeedableInfo CreateSeedableInfo(TSeedableImplementation implementation)
        {
            // A "Seedable" is actually a dicriminated union of ISeed and IScenario.
            // The way we distinguis between them everywhere is just a workaround
            // for non-existing discriminated unions in C#.

            bool isSeedImplementation = IsSeedImplemenation(implementation);

            Type?  type                = typeExtractor.ExtractFrom(implementation);
            string fullName            = fullNameExtractor.ExtractFrom(implementation);
            string friendlyName        = friendlyNameExtractor.ExtractFrom(implementation);
            string description         = descriptionExtractor.ExtractFrom(implementation);
            bool   isAlwaysRequired    = alwaysRequiredExtractor.ExtractFrom(implementation);
            var    explicitelyRequires = explicitlyRequiredSeedablesExtractor.ExtractFrom(implementation);

            return(isSeedImplementation
                ? (SeedableInfo) new SeedInfo
                   (
                       implementation,
                       type,
                       fullName,
                       friendlyName,
                       description,
                       isAlwaysRequired,
                       explicitelyRequires,
                       entitiesExtractor.ExtractFrom(implementation),
                       providedYieldExtractor.ExtractFrom(implementation),
                       requiredYieldsExtractor.ExtractFrom(implementation),
                       Array.Empty <Error>()
                   )
                : new ScenarioInfo
                   (
                       implementation,
                       type,
                       fullName,
                       friendlyName,
                       description,
                       explicitelyRequires,
                       Array.Empty <Error>()
                   ));
        }