public AddEncryptionSupportToClientsMigrationStepTests(MongoSetup mongoSetup)
     : base(mongoSetup)
 {
     _settings = new MongoDbClientStoreSettings {
         CollectionName             = "clients",
         SharedSecretEncryptionKey  = new SharedSecretEncryptionKey("The_Big_Secret"),
         ConnectionString           = "dummy",
         ClientCacheEntryExpiration = TimeSpan.Zero
     };
     _sut = new AddEncryptionSupportToClientsMigrationStep(new MongoDatabaseClientProvider(Database), _settings);
 }
        public AddEncryptionSupportToClientsMigrationStep(IMongoDatabaseClientProvider clientProvider, MongoDbClientStoreSettings mongoDbClientStoreSettings)
        {
            if (clientProvider == null)
            {
                throw new ArgumentNullException(nameof(clientProvider));
            }

            _mongoDbClientStoreSettings = mongoDbClientStoreSettings ?? throw new ArgumentNullException(nameof(mongoDbClientStoreSettings));

            _lazyCollection = new Lazy <IMongoCollection <ClientDataRecordV2> >(() => {
                var database = clientProvider.Provide();
                return(database.GetCollection <ClientDataRecordV2>(mongoDbClientStoreSettings.CollectionName));
            });
        }
Ejemplo n.º 3
0
        public AddEncryptionSupportToClientsMigrationStepTests(MongoSetup mongoSetup)
            : base(mongoSetup)
        {
            FakeFactory.Create(out _stringProtectorFactory);
            A.CallTo(() => _stringProtectorFactory.CreateSymmetric(A <string> ._))
            .Returns(new FakeStringProtector());

            _settings = new MongoDbClientStoreSettings {
                CollectionName             = "clients",
                SharedSecretEncryptionKey  = new SharedSecretEncryptionKey("The_Big_Secret"),
                ConnectionString           = "dummy",
                ClientCacheEntryExpiration = TimeSpan.Zero
            };
            _sut = new AddEncryptionSupportToClientsMigrationStep(
                new MongoDatabaseClientProvider(Database),
                _settings,
                _stringProtectorFactory);
        }
Ejemplo n.º 4
0
        public ClientStoreBaseliner(ISystemClock systemClock, IMongoDatabaseClientProvider clientProvider, MongoDbClientStoreSettings mongoDbClientStoreSettings)
        {
            if (clientProvider == null)
            {
                throw new ArgumentNullException(nameof(clientProvider));
            }
            if (mongoDbClientStoreSettings == null)
            {
                throw new ArgumentNullException(nameof(mongoDbClientStoreSettings));
            }

            _systemClock = systemClock ?? throw new ArgumentNullException(nameof(systemClock));

            _lazyCollection = new Lazy <IMongoCollection <ClientStoreVersionDocument> >(() => {
                var database = clientProvider.Provide();
                return(database.GetCollection <ClientStoreVersionDocument>(mongoDbClientStoreSettings.CollectionName));
            });
        }