Esempio n. 1
0
        public void GetShouldExpectedTransaction()
        {
            var tasks          = new List <Task>();
            var merchantId     = 1;
            var supplierId     = "1";
            var transactionsNr = 10;

            var sut = new Services.PaymentRepository();

            for (var i = 0; i < transactionsNr; i++)
            {
                var expectedTransaction = new TransactionPayment()
                {
                    TransactionId = i,
                    Payment       = new TransactionPaymentDetails()
                    {
                        SupplierId = supplierId
                    }
                };

                tasks.Add(sut.Insert(expectedTransaction, merchantId));
            }

            Task.WaitAll(tasks.ToArray());

            var transactions = sut.Get(merchantId, 4).Result;

            Assert.NotNull(transactions);
        }
Esempio n. 2
0
        public void GetShouldReturnElement()
        {
            var merchantId          = 1;
            var supplierId          = "1";
            var transactionId       = 1;
            var expectedTransaction = new TransactionPayment()
            {
                TransactionId = transactionId,
                Payment       = new TransactionPaymentDetails()
                {
                    SupplierId = supplierId
                },
            };

            var sut = new Services.PaymentRepository();

            sut.Insert(expectedTransaction, merchantId).Wait();

            var actual = sut.Get(merchantId, transactionId).Result;

            Assert.NotNull(actual);
            Assert.Equal(expectedTransaction.TransactionId, actual.TransactionId);
            var payment = actual.Payment;

            Assert.NotNull(payment);
            Assert.Equal(supplierId, payment.SupplierId);
        }