public void About()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
        public void TestSearchByName()
        {
            // Arrange
            var fakeRepository = new FakeRepositoryFactory();
            var mockMapServer = new Mock<IMapDataService>();
            HomeController controller = new HomeController(fakeRepository, mockMapServer.Object);
            //HomeController.SearchCriteria criteria = new HomeController.SearchCriteria();
            //criteria.Name = "Brays";
            string search = "Brays";
            fakeRepository.MockNeighborhoodRepository.Setup(n => n.FindBySimilarName(search)).Returns(new List<Neighborhood>{new Neighborhood{Name="Brays Village"}});
            mockMapServer.Setup(m => m.GeoCodeAddress(search)).Returns(new List<Point>());
            // Act
            ViewResult result = controller.DisplaySearchResults(search) as ViewResult;

            var resultList = result.ViewData.Model as IList<Models.Neighborhood>;

            // Assert
            Assert.IsNotNull(resultList);
            Assert.AreEqual("Brays Village",resultList[0].Name);
            //Assert.AreEqual("DisplaySearchResults", result.ViewName);
        }
        public void TestSearchByAddress()
        {
            // Arrange
            var fakeRepository = new FakeRepositoryFactory();
            var mockMapServer = new Mock<IMapDataService>();

            var address = "The Address";
            var geoCodedPoints = new List<Point>
                                     {new Point {Longitude = 1, Latitude = 2}, new Point {Longitude = 3, Latitude = 4}};

            mockMapServer.Setup(m => m.GeoCodeAddress(address)).Returns(geoCodedPoints);
            fakeRepository.MockNeighborhoodRepository.Setup(n => n.FindBySimilarName(address)).Returns(new List<Neighborhood>());

            fakeRepository.MockNeighborhoodRepository.Setup(n => n.FindNearPoint(geoCodedPoints[0])).Returns(
                new List<Neighborhood>() {new Neighborhood() {Name = "FirstOne"}});
            fakeRepository.MockNeighborhoodRepository.Setup(n => n.FindNearPoint(geoCodedPoints[1])).Returns(
                new List<Neighborhood>() { new Neighborhood() { Name = "SecondOne" } });

            HomeController controller = new HomeController(fakeRepository, mockMapServer.Object);
            //HomeController.SearchCriteria criteria = new HomeController.SearchCriteria();
            //criteria.Address = address;

            // Act
            ViewResult result = controller.DisplaySearchResults(address) as ViewResult;

            var resultList = result.ViewData.Model as IList<Models.Neighborhood>;

            // Assert
            Assert.IsNotNull(resultList);
            Assert.AreEqual(2, resultList.Count);
            Assert.AreEqual("FirstOne", resultList[0].Name);
            Assert.AreEqual("SecondOne", resultList[1].Name);
        }