public async void ShouldNotListPaymentOutOfDatePeriod(PaymentRequest payment) { using (var context = new PaymentContext(optionsFactory)) { DbPaymentRepository repository = new DbPaymentRepository(context); IEnumerable <PaymentRecord> payments = repository.GetPaymentHistoryAsync( DateTime.Today, DateTime.Today ).ToEnumerable(); Assert.Empty(payments); Guid id = await repository.RecordPaymentAsync(payment); payments = repository.GetPaymentHistoryAsync( DateTime.Today.AddDays(2), DateTime.Today.AddDays(3) ).ToEnumerable(); Assert.Empty(payments); } }
public async void ShouldListPaymentsRequestedInDatePeriod(PaymentRequest payment) { using (var context = new PaymentContext(optionsFactory)) { DbPaymentRepository repository = new DbPaymentRepository(context); IEnumerable <PaymentRecord> payments = repository .GetPaymentHistoryAsync(DateTime.Today, DateTime.Today) .ToEnumerable(); Assert.Empty(payments); Guid id = await repository.RecordPaymentAsync(payment); payments = repository .GetPaymentHistoryAsync(DateTime.Today, DateTime.Today) .ToEnumerable(); Assert.Collection(payments, item => { Assert.Equal(payment.Sum, item.PaymentSum); Assert.Equal(payment.Purpose, item.Purpose); }); } }