public async Task ConfirmAlreadyConfirmedTransaction() { var db = new SqliteInMemoryDatabase(); var tsx = new DatabaseTransactions(db); var pending = new DatabasePendingTransactions(db, tsx); var now = DateTime.UtcNow; var(a, b, c, d) = await CreateTestTransactions(now, pending); Assert.AreEqual(ConfirmResult.Confirmed, await pending.ConfirmPending(a)); Assert.AreEqual(ConfirmResult.AlreadyConfirmed, await pending.ConfirmPending(a)); var notConfirmed = await(pending.Get(state: PendingState.Pending)).ToArrayAsync(); Assert.AreEqual(3, notConfirmed.Length); }
public async Task ConfirmNotExistsTransaction() { var db = new SqliteInMemoryDatabase(); var tsx = new DatabaseTransactions(db); var pending = new DatabasePendingTransactions(db, tsx); var now = DateTime.UtcNow; var(a, b, c, d) = await CreateTestTransactions(now, pending); Assert.AreEqual(ConfirmResult.IdNotFound, await pending.ConfirmPending(d + 10)); var notConfirmed = await(await pending.Get(state: PendingState.Pending)).ToArray(); Assert.AreEqual(4, notConfirmed.Length); }
public async Task ConfirmPendingTransaction() { var db = new SqliteInMemoryDatabase(); var tsx = new DatabaseTransactions(db); var pending = new DatabasePendingTransactions(db, tsx); var now = DateTime.UtcNow; var(a, b, c, d) = await CreateTestTransactions(now, pending); var transactionsBefore = await(await tsx.GetTransactions(0, 1, "TEST")).ToArray(); Assert.AreEqual(0, transactionsBefore.Length); Assert.AreEqual(ConfirmResult.Confirmed, await pending.ConfirmPending(a)); var notConfirmed = await(await pending.Get(state: PendingState.Pending)).ToArray(); Assert.AreEqual(3, notConfirmed.Length); var transactionsAfter = await(await tsx.GetTransactions(0, 1, "TEST")).ToArray(); Assert.AreEqual(1, transactionsAfter.Length); }