Example #1
0
        public void AllSpecifications_ReturnOneCustomer(ILinqSpecification <Customer> specification, int expectedId)
        {
            var sut = specification.GetExpression();

            var result = Context.Customers
                         .Where(sut).ToList();

            Assert.Single(result);
            Assert.Equal(expectedId, result.First().CustomerId);
        }
Example #2
0
        public void AllSpecificationsNegation_ReturnTwoCustomers(ILinqSpecification <Customer> specification, int first,
                                                                 int second)
        {
            var sut = specification.GetExpression();

            var result = Context.Customers
                         .Where(sut).ToList();

            Assert.Equal(2, result.Count);
            Assert.Equal(first, result.First().CustomerId);
            Assert.Equal(second, result.Last().CustomerId);
        }