/// <summary>
        /// Populate the data grid with information sorted by cars' fuel economy in descending order
        /// </summary>
        private void PopulateDataGridViewSortCarsByFuelEconomyDescending()
        {
            dataGridView.Rows.Clear(); HideSpecificInfo();
            CarBusiness carBusiness = new CarBusiness();
            var         carsList    = carBusiness.SortCarsByFuelEconomyDescending();

            DataPopulator(carsList);
            dataGridView.Columns[8].Visible = true;
        }
        public void SortCarsByFuelEconomyDescending()
        {
            var data = new List <Car>
            {
                new Car {
                    Engine = new Engine {
                        EconomyPerHundredKm = 5m
                    }
                },
                new Car {
                    Engine = new Engine {
                        EconomyPerHundredKm = 6m
                    }
                },
                new Car {
                    Engine = new Engine {
                        EconomyPerHundredKm = 7m
                    }
                }
            }.AsQueryable();

            var mockSet = new Mock <DbSet <Car> >();

            mockSet.As <IQueryable <Car> >().Setup(m => m.Provider).Returns(data.Provider);
            mockSet.As <IQueryable <Car> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <Car> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <Car> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var mockContext = new Mock <CarDealershipContext>();

            mockContext.Setup(m => m.Cars).Returns(mockSet.Object);

            var service    = new CarBusiness(mockContext.Object);
            var SortedCars = service.SortCarsByFuelEconomyDescending();

            Assert.AreEqual(7m, SortedCars[0].Engine.EconomyPerHundredKm);
            Assert.AreEqual(6m, SortedCars[1].Engine.EconomyPerHundredKm);
            Assert.AreEqual(5m, SortedCars[2].Engine.EconomyPerHundredKm);
        }