public void Null_query_throws() { IDb db = new MemDb(); ConsumerDepositApprovalRocksRepository repository = new ConsumerDepositApprovalRocksRepository(db, new DepositApprovalDecoder()); Assert.Throws <ArgumentNullException>(() => repository.BrowseAsync(null)); }
public async Task Browse_empty_database() { IDb db = new MemDb(); ConsumerDepositApprovalRocksRepository repository = new ConsumerDepositApprovalRocksRepository(db, new DepositApprovalDecoder()); PagedResult <DepositApproval> depositApprovals = await repository.BrowseAsync(new GetConsumerDepositApprovals()); depositApprovals.Items.Should().HaveCount(0); }
public async Task Browse_empty() { IDb db = new MemDb(); ConsumerDepositApprovalRocksRepository repository = new ConsumerDepositApprovalRocksRepository(db, new DepositApprovalDecoder()); foreach (DepositApproval approval in _cases) { await repository.AddAsync(approval); } PagedResult <DepositApproval> depositApprovals = await repository.BrowseAsync(new GetConsumerDepositApprovals { DataAssetId = Keccak.Zero }); depositApprovals.Items.Should().HaveCount(0); }
public async Task Browse_pending_only() { IDb db = new MemDb(); ConsumerDepositApprovalRocksRepository repository = new ConsumerDepositApprovalRocksRepository(db, new DepositApprovalDecoder()); foreach (DepositApproval approval in _cases) { await repository.AddAsync(approval); } PagedResult <DepositApproval> depositApprovals = await repository.BrowseAsync(new GetConsumerDepositApprovals { OnlyPending = true }); depositApprovals.Items.Should().ContainSingle(da => da.State == DepositApprovalState.Pending); }
public async Task Browse_by_provider() { IDb db = new MemDb(); ConsumerDepositApprovalRocksRepository repository = new ConsumerDepositApprovalRocksRepository(db, new DepositApprovalDecoder()); foreach (DepositApproval approval in _cases) { await repository.AddAsync(approval); } PagedResult <DepositApproval> depositApprovals = await repository.BrowseAsync(new GetConsumerDepositApprovals { Provider = TestItem.AddressB }); depositApprovals.Items.Should().ContainSingle(da => da.Provider == TestItem.AddressB); }