public static async Task GetTransfersInProgressAsync_WalletAddressConditionCheck( IOperationsRepository repo, IOperationRequestsRepository requestsRepo, IQuorumOperationExecutorClient executorClient, string includeWalletAddress) { var rnd = new Random(); var o = await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 1, includeWalletAddress, OperationType.TokensTransfer, new TokensTransferContext { SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next() }.ToJson(), DateTime.UtcNow, ValidTransactionHashes[0]); await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 2, includeWalletAddress, OperationType.TokensTransfer, new TokensTransferContext { SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next() }.ToJson(), DateTime.UtcNow, string.Empty); await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 3, $"{includeWalletAddress}-{rnd.Next()}", OperationType.CustomerWalletCreation, new CustomerWalletContext { CustomerId = FakeCustomerId, WalletAddress = includeWalletAddress } .ToJson(), DateTime.UtcNow, string.Empty); }
public static async Task GetTransfersInProgressAsync_OperationStatusConditionCheck( IOperationsRepository repo, IOperationRequestsRepository requestsRepo, IQuorumOperationExecutorClient executorClient) { var rnd = new Random(); var statusUpdater = new OperationStatusUpdater( EmptyLogFactory.Instance, new TransactionScopeHandler(EmptyLogFactory.Instance), repo, executorClient, requestsRepo); var o1 = await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 1, FakeWalletAddress, OperationType.TokensTransfer, new TokensTransferContext { SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next() }.ToJson(), DateTime.UtcNow, ValidTransactionHashes[0]); var o2 = await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 2, FakeWalletAddress, OperationType.TokensTransfer, new TokensTransferContext { SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next() }.ToJson(), DateTime.UtcNow, ValidTransactionHashes[1]); var o3 = await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 3, FakeWalletAddress, OperationType.TokensTransfer, new TokensTransferContext { SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next() }.ToJson(), DateTime.UtcNow, ValidTransactionHashes[2]); await statusUpdater.SucceedAsync(ValidTransactionHashes[2]); var o4 = await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 4, FakeWalletAddress, OperationType.TokensTransfer, new TokensTransferContext { SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next() }.ToJson(), DateTime.UtcNow, ValidTransactionHashes[3]); await statusUpdater.FailAsync(ValidTransactionHashes[3]); var o5 = await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 5, FakeWalletAddress, OperationType.CustomerWalletCreation, new CustomerWalletContext { CustomerId = FakeCustomerId, WalletAddress = FakeWalletAddress }.ToJson(), DateTime.UtcNow, ValidTransactionHashes[4]); await statusUpdater.AcceptAsync(o5, ValidTransactionHashes[4]); var o6 = await repo.AddAsync( Guid.NewGuid(), FakeCustomerId, 6, FakeWalletAddress, OperationType.CustomerWalletCreation, new CustomerWalletContext { CustomerId = FakeCustomerId, WalletAddress = FakeWalletAddress }.ToJson(), DateTime.UtcNow, ValidTransactionHashes[5]); }