예제 #1
0
        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);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }