public async Task ProviderInitTests_BeamSyncDbProvider() { var syncModeSelector = Substitute.For <ISyncModeSelector>(); var dbProvider = TestMemDbProvider.Init(); var rocksDbFactory = new RocksDbFactory(new DbConfig(), LimboLogs.Instance, Path.Combine(_folderWithDbs, "beam")); IDbProvider beamSyncDbProvider = new BeamSyncDbProvider(syncModeSelector, dbProvider, new SyncConfig(), LimboLogs.Instance); var initializer = new BaselineDbInitializer(beamSyncDbProvider, new BaselineConfig(), rocksDbFactory, new MemDbFactory()); await initializer.Init(); Assert.NotNull(beamSyncDbProvider.GetDb <IDb>(BaselineDbNames.BaselineTree)); Assert.NotNull(beamSyncDbProvider.GetDb <IDb>(BaselineDbNames.BaselineTreeMetadata)); Assert.IsTrue(beamSyncDbProvider.GetDb <IDb>(BaselineDbNames.BaselineTree) is MemDb); Assert.IsTrue(beamSyncDbProvider.GetDb <IDb>(BaselineDbNames.BaselineTreeMetadata) is MemDb); }
public async Task ProviderInitTests_BeamSyncDbProvider() { var syncModeSelector = Substitute.For <ISyncModeSelector>(); var dbProvider = await TestMemDbProvider.InitAsync(); var rocksDbFactory = new RocksDbFactory(new DbConfig(), LimboLogs.Instance, Path.Combine(_folderWithDbs, "beam")); IDbProvider beamSyncDbProvider = new BeamSyncDbProvider(syncModeSelector, dbProvider, new SyncConfig(), LimboLogs.Instance); var initializer = new ConsumerNdmDbInitializer(beamSyncDbProvider, new NdmConfig(), rocksDbFactory, new MemDbFactory()); initializer.Reset(); await initializer.InitAsync(); Assert.IsTrue(beamSyncDbProvider.GetDb <IDb>(ConsumerNdmDbNames.ConsumerDepositApprovals) is MemDb); Assert.IsTrue(beamSyncDbProvider.GetDb <IDb>(ConsumerNdmDbNames.ConsumerReceipts) is MemDb); Assert.IsTrue(beamSyncDbProvider.GetDb <IDb>(ConsumerNdmDbNames.ConsumerSessions) is MemDb); Assert.IsTrue(beamSyncDbProvider.GetDb <IDb>(ConsumerNdmDbNames.Deposits) is MemDb); }