public void GetAllCustomersShouldReturnAllDataWhenDefaultValuesUsed()
        {
            // Arrange
            var interceptors = new DefaultRepositoryInterceptors(new NorthwindQueryRepositoryInterceptor());
            var repository = new InMemoryRepository(interceptors);

            for (int i = 0; i < 15; i++)
            {
                repository.Add(EntityGenerator.Create<Customer>(
                    p => p.CompanyName = p.CompanyName + i,
                    p => p.CustomerID = i.ToString(),
                    p => p.Orders.First().OrderDetails.First().Quantity = (short)i,
                    p => p.Orders.First().OrderDetails.First().UnitPrice = 100.0M));
            }

            // Act
            var ordersController = new OrdersController(repository);
            var results = ordersController.GetAllCustomers().Result;

            // Assert
            results.Count().ShouldEqual(15);
            for (int i = 0; i < 15; i++)
            {
                results.ElementAt(i).CustomerId.ShouldEqual(i.ToString());
                results.ElementAt(i).CompanyName.ShouldEqual("CompanyName" + i);
                results.ElementAt(i).CombinedOrderValue.ShouldEqual(100 * i);
            }
        }
        public void GetAllCustomersShouldReturnCorrectDataWhenMinOrderSupplied()
        {
            // Arrange
            var interceptors = new DefaultRepositoryInterceptors(new NorthwindQueryRepositoryInterceptor());
            var repository = new InMemoryRepository(interceptors);

            for (int i = 0; i < 15; i++)
            {
                repository.Add(EntityGenerator.Create<Customer>(
                    p => p.CompanyName = p.CompanyName + i,
                    p => p.CustomerID = i.ToString(),
                    p => p.Orders.First().OrderDetails.First().Quantity = (short)i,
                    p => p.Orders.First().OrderDetails.First().UnitPrice = 100.0M));
            }

            // Act
            var ordersController = new OrdersController(repository);

            // Assert
            var results = ordersController.GetAllCustomers(minOrderValue: 100 * 10).Result;
            results.Count().ShouldEqual(5);
        }
        public void GetAllCustomersShouldReturnCorrectDataWhenOrderedByDesc()
        {
            // Arrange
            var interceptors = new DefaultRepositoryInterceptors(new NorthwindQueryRepositoryInterceptor());
            var repository = new InMemoryRepository(interceptors);

            for (int i = 0; i < 15; i++)
            {
                repository.Add(EntityGenerator.Create<Customer>(
                    p => p.CompanyName = p.CompanyName + i,
                    p => p.CustomerID = i.ToString(),
                    p => p.Orders.First().OrderDetails.First().Quantity = (short)i,
                    p => p.Orders.First().OrderDetails.First().UnitPrice = 100.0M));
            }

            // Act
            var ordersController = new OrdersController(repository);
            var results = ordersController.GetAllCustomers(take: 1, skip: 0, ascending: false).Result;

            // Assert
            results.Single().CustomerId.ShouldEqual("14");
        }