Exemple #1
0
        public void Setup()
        {
            Reset();

            _dataProviderDependenciesFactory = SetupMock <IDataProviderDependenciesFactory>();
            _nameManager            = SetupMock <INameManager>();
            _dataCatalog            = SetupMock <IDataCatalog>();
            _dataSupplierFactory    = SetupMock <IDataSupplierFactory>();
            _dataDependencyFactory  = SetupMock <IDataDependencyFactory>();
            _requestRouter          = SetupMock <IRequestRouter>();
            _frameworkConfiguration = SetupMock <IFrameworkConfiguration>();

            _elementConfiguror = new ElementConfiguror(
                _dataSupplierFactory,
                _dataDependencyFactory,
                _nameManager,
                _requestRouter);

            _fluentBuilder = new FluentBuilder(
                _nameManager,
                _dataCatalog,
                _dataProviderDependenciesFactory.DataDependencyFactory,
                _dataProviderDependenciesFactory.DataSupplierFactory,
                _frameworkConfiguration);

            _fluentBuilder.DataProviderBuilder = new DataProviderBuilder(
                _dataProviderDependenciesFactory,
                _elementConfiguror,
                _nameManager,
                _fluentBuilder);
        }
Exemple #2
0
 public DataStoreConnectionFactory(
     IFrameworkConfiguration configuration,
     ISessionManager sessionManager)
 {
     _providerType     = configuration.GetValue <ProviderType>(ProviderTypeKey);
     _connectionString = configuration.GetValue <string>(EFCoreConnectionStringKey);
     _sessionManager   = sessionManager;
 }
Exemple #3
0
 public SessionScopedContextFactory(
     ISessionManager sessionManager,
     IFrameworkConfiguration configuration)
 {
     _sessionManager   = sessionManager;
     _providerType     = configuration.GetValue <ProviderType>(ProviderTypeKey);
     _connectionString = configuration.GetValue <string>(EFCoreConnectionStringKey);
 }
        public ApplicationConfiguration(TContainer container, IFrameworkConfiguration framework)
        {
            Check.NotNull(container, nameof(container));
            Check.NotNull(framework, nameof(framework));

            this.Container = container;
            this.Framework = framework;
        }
Exemple #5
0
 public LibrariesPackage(
     IPackageDependenciesFactory dependencies,
     IFrameworkConfiguration frameworkConfiguration)
     : base(dependencies)
 {
     _frameworkConfiguration = frameworkConfiguration;
     Name          = "libraries";
     NamespaceName = "libraries";
 }
Exemple #6
0
        public AssetManager(
            IRequestRouter requestRouter,
            IFrameworkConfiguration frameworkConfiguration,
            ICssWriterFactory cssWriterFactory,
            IJavascriptWriterFactory javascriptWriterFactory,
            IStringBuilderFactory stringBuilderFactory,
            IDictionaryFactory dictionaryFactory)
        {
            _frameworkConfiguration  = frameworkConfiguration;
            _cssWriterFactory        = cssWriterFactory;
            _javascriptWriterFactory = javascriptWriterFactory;
            _stringBuilderFactory    = stringBuilderFactory;

            _elementsAddedToWebsite = new HashSet <string>();
            _elementsAddedToModule  = dictionaryFactory.Create <string, HashSet <string> >();
            _elementsAddedToPage    = dictionaryFactory.Create <string, HashSet <string> >();

            _moduleStyles    = dictionaryFactory.Create <string, string>();
            _moduleFunctions = dictionaryFactory.Create <string, string>();
            _pageStyles      = dictionaryFactory.Create <string, string>();
            _pageFunctions   = dictionaryFactory.Create <string, string>();

            _websiteStylesBuilder    = stringBuilderFactory.Create();
            _websiteFunctionsBuilder = stringBuilderFactory.Create();

            _moduleStyleBuilders    = dictionaryFactory.Create <string, IStringBuilder>();
            _moduleFunctionBuilders = dictionaryFactory.Create <string, IStringBuilder>();
            _pageStyleBuilders      = dictionaryFactory.Create <string, IStringBuilder>();
            _pageFunctionBuilders   = dictionaryFactory.Create <string, IStringBuilder>();

            frameworkConfiguration.Subscribe(config =>
            {
                var rootPath = config.AssetRootPath;
                if (rootPath.EndsWith("/") && rootPath.Length > 1)
                {
                    rootPath = rootPath.Substring(0, rootPath.Length - 1);
                }
                _rootPath = new PathString(rootPath);

                var priorRegistration = _runableRegistration;

                _runableRegistration = requestRouter.Register(this,
                                                              new FilterAllFilters(
                                                                  new FilterByMethod(Method.Get),
                                                                  new FilterByPath(_rootPath.Value + "/**")), -10);

                if (priorRegistration != null)
                {
                    priorRegistration.Dispose();
                }
            });
        }
Exemple #7
0
        public static void CreateHarnessFile(IFrameworkConfiguration configuration, IEnumerable <string> files, string outputPath, string outputFile)
        {
            var harness  = PathFinder.GetApplicationPath(configuration.Harness);
            var template = File.ReadAllText(harness);

            //TODO: unhardcode (fetch from detest.json)
            //TODO: for some reason this isn't necessary, script files fetched from harness are not relative to baseUrl.
            // var scriptsRoot = Path.Combine(outputPath, "Scripts");

            var relativePathFiles = files.Select(f => PathFinder.GetRelativePathUri(f, outputPath));
            var generated         = Construct(template, relativePathFiles);
            var targetFile        = Path.Combine(outputPath, outputFile);

            File.WriteAllText(targetFile, generated);
        }
        public FluentBuilder(
            INameManager nameManager,
            IDataCatalog dataCatalog,
            IDataDependencyFactory dataDependencyFactory,
            IDataSupplierFactory dataSupplierFactory,
            IFrameworkConfiguration frameworkConfiguration)
        {
            _nameManager           = nameManager;
            _dataCatalog           = dataCatalog;
            _dataDependencyFactory = dataDependencyFactory;
            _dataSupplierFactory   = dataSupplierFactory;
            _assemblies            = new HashSet <string>();
            _types = new HashSet <Type>();

            frameworkConfiguration.Subscribe(config => _debugLogging = config.DebugLogging);
        }
Exemple #9
0
        public TemplatesPackage(
            IFrameworkConfiguration frameworkConfiguration,
            IHostingEnvironment hostingEnvironment,
            IComponentDependenciesFactory componentDependencies)
        {
            Name          = "templates";
            NamespaceName = "templates";

            _resourceManager          = new ResourceManager(hostingEnvironment, new MimeTypeEvaluator());
            _templateLibraryComponent = new TemplateLibraryComponent(componentDependencies);

            frameworkConfiguration.Subscribe(c =>
            {
                _servicePath = c.ServicesRootPath + "/templates";
                _templateLibraryComponent.Configure(
                    NamespaceName,
                    _servicePath + "/template?path=");
            });
        }
Exemple #10
0
        public NameManager(
            IFrameworkConfiguration frameworkConfiguration)
        {
            _pendingActions = new List <PendingActionBase>();

            _components    = new Dictionary <string, IComponent>(StringComparer.InvariantCultureIgnoreCase);
            _regions       = new Dictionary <string, IRegion>(StringComparer.InvariantCultureIgnoreCase);
            _layouts       = new Dictionary <string, ILayout>(StringComparer.InvariantCultureIgnoreCase);
            _pages         = new Dictionary <string, IPage>(StringComparer.InvariantCultureIgnoreCase);
            _services      = new Dictionary <string, IService>(StringComparer.InvariantCultureIgnoreCase);
            _modules       = new Dictionary <string, IModule>(StringComparer.InvariantCultureIgnoreCase);
            _packages      = new Dictionary <string, IPackage>(StringComparer.InvariantCultureIgnoreCase);
            _dataProviders = new Dictionary <string, IDataProvider>(StringComparer.InvariantCultureIgnoreCase);
            _templates     = new Dictionary <string, ITemplate>(StringComparer.InvariantCultureIgnoreCase);

            _assetNames = new Dictionary <string, HashSet <string> >(StringComparer.InvariantCultureIgnoreCase);

            _pendingElementRegistrations      = new List <IElement>();
            _pendingDataProviderRegistrations = new List <IDataProvider>();
            _pendingRunableRegistrations      = new List <IRunable>();

            _random = new Random();
            frameworkConfiguration.Subscribe(config => _debugLogging = config.DebugLogging);
        }
 private FrameworkEnvironment(IFrameworkConfiguration configuration)
 {
     Configuration = configuration;
 }
Exemple #12
0
 public static T GetValue <T>(this IFrameworkConfiguration configuration, string key)
 {
     return((T)configuration.Values[key]);
 }
Exemple #13
0
 public SnapshotOnEventCountStrategy(IFrameworkConfiguration frameworkConfiguration, ISnapshotStore snapshotStore)
 {
     _eventsBeforeSnapshot = frameworkConfiguration.GetValue <int>(ConfigurationKey);
     _snapshotStore        = snapshotStore;
 }
        public static IEnumerable <TestCase> GetTests(IFrameworkConfiguration configuration, IEnumerable <string> sources)
        {
            var analyzer = PathFinder.GetApplicationPath(configuration.Analyzer);

            return(GetTests(analyzer, sources).ToList());
        }