public void GetTownByName()
        {
            var data = new List <Town>
            {
                new Town {
                    Name = "Town1"
                },
                new Town {
                    Name = "Town2"
                },
                new Town {
                    Name = "Town3"
                },
            }.AsQueryable();

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

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

            var mockContext = new Mock <CarDealershipContext>();

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

            var service   = new TownBusiness(mockContext.Object);
            var TownFound = service.GetTownByName("Town1");

            Assert.AreEqual("Town1", TownFound.Name);
        }
        /// <summary>
        /// Populate the data grid with information about town with given town name
        /// </summary>
        private void PopulateDataGridViewGetTownByName()
        {
            dataGridView.Rows.Clear();
            TownBusiness townBusiness = new TownBusiness();
            var          town         = townBusiness.GetTownByName(txtGet.Text);

            DataPopulatorSingle(town);
        }