Beispiel #1
0
        public void PaymentDbFilter_WhenReceiverHasPayments_ShouldReturnOnlyReceiversPayments()
        {
            //Arrange
            var sutBuilder = new PaymentDbFilterSutBuilder();
            var payments   = sutBuilder.Setup();
            var filterInfo = new PaymentFilterInfo
            {
                ReceiverId = payments[0].ReceiverId,
            };
            var filter = new PaymentDbFilter(filterInfo);

            var queryablePayments = payments.AsQueryable();

            payments = payments.Where(u => u.ReceiverId == filterInfo.ReceiverId).ToList();

            //Act
            var result = filter.ApplyFilter(queryablePayments).ToList();

            //Assert
            result.ShouldBe(payments);
        }
Beispiel #2
0
        public void PaymentDbFilter_WhenThereArePaymentsCreatedBeforeCertainTime_ShouldReturnAllPaymentsCreatedBeforeThatTime()
        {
            //Arrange
            var sutBuilder = new PaymentDbFilterSutBuilder();
            var payments   = sutBuilder.Setup();
            var filterInfo = new PaymentFilterInfo
            {
                EndTime = DateTime.Now.AddMilliseconds(1000),
            };
            var filter = new PaymentDbFilter(filterInfo);

            var queryablePayments = payments.AsQueryable();

            payments = payments.Where(u => u.CreationTime < filterInfo.EndTime).ToList();

            //Act
            var result = filter.ApplyFilter(queryablePayments).ToList();

            //Assert
            result.ShouldBe(payments);
        }