Example #1
0
        public BlogSettingsConfigurationProviderTests(MongoDbDatabaseFixture fixture) : base(fixture)
        {
            var connectionStringName = Configuration.GetSection(nameof(PineBlogOptions)).GetValue <string>(nameof(PineBlogOptions.ConnectionStringName));
            var databaseName         = Configuration.GetSection(nameof(PineBlogOptions)).GetValue <string>(nameof(PineBlogOptions.MongoDbDatabaseName));
            var connectionString     = Configuration.GetConnectionString(connectionStringName);

            _provider = new BlogSettingsConfigurationProvider(new BlogSettingsConfigurationSource
            {
                ConnectionString = connectionString,
                DatabaseName     = databaseName,
                ReloadOnChange   = true
            });
        }
Example #2
0
        public MongoDbTestsBase(MongoDbDatabaseFixture fixture)
        {
            Configuration = BuildConfiguration(fixture.Runner.ConnectionString);

            Services = new ServiceCollection();
            Services.AddPineBlogCore(Configuration);
            Services.AddPineBlogMongoDb(Configuration);

            var database = ((BlogUnitOfWork)ServiceProvider.GetRequiredService <IBlogUnitOfWork>()).Database;

            BlogSettingsCollection = database.GetCollection <BlogSettings>(CollectionHelper.GetName <BlogSettings>());
            AuthorCollection       = database.GetCollection <Author>(CollectionHelper.GetName <Author>());
            PostCollection         = database.GetCollection <Post>(CollectionHelper.GetName <Post>());
        }
 public ServiceCollectionExtensionsTests(MongoDbDatabaseFixture fixture) : base(fixture)
 {
 }