Exemple #1
0
        public async Task CheckLegalTransaction()
        {
            Transaction       transaction       = Transaction.Instance;
            TransactionStatus transactionStatus = await transaction.ActivateTransaction(testUser.Username, "0544444444", WEIGHT1, testStoreAddress, testUserAddress, testUserCreditCard, testStore.GetId(), testStore.name, testStoreCreditCard, 1, shoppingBasket);

            Assert.AreEqual(transactionStatus.Status, true);
            Assert.AreEqual(transactionStatus.DeliveryStatus.Status, true);
            Assert.AreEqual(transactionStatus.PaymentStatus.Status, true);
        }
Exemple #2
0
        public async Task CheckUnAvailablePaymentTransaction()
        {
            Mock <ExternalPaymentSystem> paymentSystem = new Mock <ExternalPaymentSystem>();

            paymentSystem.Setup(p => p.CreatePaymentAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult("-1"));
            Transaction transaction = Transaction.Instance;

            transaction.PaymentAdapter.SetPaymentSystem(paymentSystem.Object);
            TransactionStatus transactionStatus = await transaction.ActivateTransaction(testUser.Username, "0544444444", WEIGHT1, testStoreAddress, testUserAddress, testUserCreditCard, testStore.GetId(), testStore.name, testStoreCreditCard, 1, shoppingBasket);

            Assert.AreEqual(transactionStatus.Status, false);
            Assert.IsNull(transactionStatus.DeliveryStatus);
            Assert.AreEqual(transactionStatus.PaymentStatus.Status, false);
        }