public async Task Add_get(DepositApproval approval) { IDb db = new MemDb(); ConsumerDepositApprovalRocksRepository repository = new ConsumerDepositApprovalRocksRepository(db, new DepositApprovalDecoder()); await repository.AddAsync(approval); DepositApproval retrieved = await repository.GetAsync(approval.Id); retrieved.Should().BeEquivalentTo(approval); }
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_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_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); }