public async Task DenyAlreadyDeniedTransaction()
        {
            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(DenyResult.Denied, await pending.DenyPending(a));
            Assert.AreEqual(DenyResult.AlreadyDenied, await pending.DenyPending(a));

            var notConfirmed = await(pending.Get(state: PendingState.Pending)).ToArrayAsync();

            Assert.AreEqual(3, notConfirmed.Length);
        }
예제 #2
0
        public async Task DenyNotExistsTransaction()
        {
            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(DenyResult.IdNotFound, await pending.DenyPending(d + 10));

            var notConfirmed = await(await pending.Get(state: PendingState.Pending)).ToArray();

            Assert.AreEqual(4, notConfirmed.Length);
        }
예제 #3
0
        public async Task DenyPendingTransaction()
        {
            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(DenyResult.Denied, await pending.DenyPending(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(0, transactionsAfter.Length);
        }