Esempio n. 1
0
        public void Initialize()
        {
            _targetFolder = Path.Combine(UnitTestHelpers.BaseDir, @"source",
                                         DateTime.Now.ToString("yyyy-dd-M__HH-mm-ss") + "_" + Guid.NewGuid().ToString());
            Directory.CreateDirectory(_targetFolder);
            GlobalTenantDatabaseBiggyConfig = new TenantDatabaseBiggyConfig();
            GlobalTenantDatabaseBiggyConfig.UsingFolder(TargetFolder);
            GlobalTenantDatabaseBiggyConfig.UsingTenantId(TenantDatabaseBiggyConfig.GlobalTenantId);
            IIdentityServer4BiggyConfiguration biggyConfiguration = new MyBiggyConfiguration()
            {
                FolderStorage = GlobalTenantDatabaseBiggyConfig.Folder,
                DatabaseName  = GlobalTenantDatabaseBiggyConfig.Database,
                TenantId      = GlobalTenantDatabaseBiggyConfig.TenantId.ToString()
            };

            var hostName            = typeof(MyAutofacFactory).GetTypeInfo().Assembly.GetName().Name;
            var hostingEnvironment  = A.Fake <IHostingEnvironment>();
            var httpContextAccessor = A.Fake <IHttpContextAccessor>();


            hostingEnvironment.ApplicationName = hostName;
            Global.HostingEnvironment          = hostingEnvironment;
            AutofacStoreFactory = new MyAutofacFactory()
            {
                BiggyConfiguration = biggyConfiguration
            };
        }
Esempio n. 2
0
        public async Task Initialize()
        {
            _targetFolder = Path.Combine(UnitTestHelpers.BaseDir, @"source",
                                         DateTime.Now.ToString("yyyy-dd-M__HH-mm-ss") + "_" + Guid.NewGuid().ToString());
            Directory.CreateDirectory(_targetFolder);
            GlobalTenantDatabaseBiggyConfig = new TenantDatabaseBiggyConfig();
            GlobalTenantDatabaseBiggyConfig.UsingFolder(TargetFolder);
            GlobalTenantDatabaseBiggyConfig.UsingTenantId(TenantDatabaseBiggyConfig.GlobalTenantId);
            IBlogStoreBiggyConfiguration biggyConfiguration = new MyBlogStoreBiggyConfiguration()
            {
                FolderStorage = GlobalTenantDatabaseBiggyConfig.Folder,
                DatabaseName  = GlobalTenantDatabaseBiggyConfig.Database,
                TenantId      = GlobalTenantDatabaseBiggyConfig.TenantId.ToString()
            };

            var hostName            = typeof(MyAutofacFactory).GetTypeInfo().Assembly.GetName().Name;
            var hostingEnvironment  = A.Fake <IHostingEnvironment>();
            var httpContextAccessor = A.Fake <IHttpContextAccessor>();


            hostingEnvironment.ApplicationName = hostName;
            Global.HostingEnvironment          = hostingEnvironment;
            AutofacStoreFactory = new MyAutofacFactory()
            {
                BlogStoreBiggyConfiguration = biggyConfiguration
            };

            Executer           = AutofacStoreFactory.Resolve <IDocumentExecuter>();
            Writer             = AutofacStoreFactory.Resolve <IDocumentWriter>();
            GraphQLUserContext = AutofacStoreFactory.Resolve <GraphQLUserContext>();

            var graphQLFieldAuthority = AutofacStoreFactory.Resolve <InMemoryGraphQLFieldAuthority>();

            InsertBlogEntriesIntoStore(10);
        }
Esempio n. 3
0
        /// <summary>
        /// Adds IdentityServer4 biggy configuration.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="dbPath">The full path to where biggy store the data.</param>
        /// <returns></returns>
        public static ContainerBuilder AddIdentityServer4BiggyConfiguration(this ContainerBuilder builder, string dbPath)
        {
            var globalTenantDatabaseBiggyConfig = new TenantDatabaseBiggyConfig();

            globalTenantDatabaseBiggyConfig.UsingFolder(dbPath);
            globalTenantDatabaseBiggyConfig.UsingTenantId(TenantDatabaseBiggyConfig.GlobalTenantId);
            IIdentityServer4BiggyConfiguration biggyConfiguration = new MyBiggyConfiguration()
            {
                FolderStorage = globalTenantDatabaseBiggyConfig.Folder,
                DatabaseName  = globalTenantDatabaseBiggyConfig.Database
            };

            builder.Register(c => biggyConfiguration)
            .As <IIdentityServer4BiggyConfiguration>()
            .SingleInstance();
            return(builder);
        }