Exemplo n.º 1
0
        public async Task GetByMerchantId_When_MerchantId_Has_No_Payments_Return_Empty_List()
        {
            var mockContext = new Mock <PaymentsDbContext>();

            mockContext.Setup(x => x.Payments).ReturnsDbSet(Payments);

            var service = new ReadService(mockContext.Object);

            var actual = await service.GetByMerchantId(123);

            actual.Should().HaveCount(0);
        }
Exemplo n.º 2
0
        public async Task GetByMerchantId_When_MerchantId_Has_Payments_Return_Payments_List()
        {
            var payment = new Payment
            {
                PaymentId  = 321,
                MerchantId = 123,
                Amount     = 234.23m,
                Currency   = "USD"
            };

            Payments.Add(payment);

            var mockContext = new Mock <PaymentsDbContext>();

            mockContext.Setup(x => x.Payments).ReturnsDbSet(Payments);


            var service = new ReadService(mockContext.Object);

            var payments = await service.GetByMerchantId(123);

            payments.Should().HaveCount(1);
        }