public void Search_ReturnsCollectionOfTypeSearchResult()
        {
            // Arrange
            var req = new SearchRequest()
            {
                ArrAirportCode = "MEL",
                ArrDate = DateTime.Parse("1/1/2005"),
                DeptAirportCode = "DEL",
                DeptDate = DateTime.Parse("1/1/2005")
            };
            var flightSearchRepository = new Mock<IFlightSearchRepository>();
            var helper = new Mock<IHelper>();
            NameValueCollection Parameters = new NameValueCollection();
            Parameters.Add("DepartureAirportCode", "MEL");
            IEnumerable<SearchResult> SearchRes = Enumerable.Empty<SearchResult>();
            var MokResult = new Mock<IEnumerable<SearchResult>>();
            helper.Setup(e => e.GetBaseUrl()).Returns("http://localhost");

            flightSearchRepository.Setup(e => e.Search(
                new List<Provider> { new Provider() { ProviderUri  = "",
                                                      JsonDataPropertyName = ""
                                                    }
                                    }, Parameters)).Returns(Task.FromResult<IEnumerable<SearchResult>>(SearchRes)) ;

            HomeController sut = new HomeController(flightSearchRepository.Object, helper.Object);

            // Act
            var actual = sut.Search(req);

            // Assert
            flightSearchRepository.Verify(s => s.Search(It.IsAny<List<Provider>>(), It.IsAny<NameValueCollection>()), Times.Once);
            Assert.IsInstanceOfType(((ViewResult)actual.Result).Model,typeof(List<SearchResult>));
        }
        public async Task<ActionResult> Search(SearchRequest req)
        {
            NameValueCollection Parameters = new NameValueCollection();
            List<Provider> ProviderList = new List<Provider>();
            Provider P = new Provider();
            Helper helper = new Helper();
            P.ProviderUri = this.helper.GetBaseUrl() + "/api/SearchFlights";
            P.JsonDataPropertyName = "";
            ProviderList.Add(P);
            foreach (var item in req.GetType().GetProperties().ToList())
            {
                Parameters.Add(item.Name,item.GetValue(req,null).ToString());
            }
            
            IEnumerable<SearchResult> results = await this.flightSearchRepository.Search(ProviderList, Parameters);

            return View(results);
        }
 public ActionResult Index()
 {
     SearchRequest sr = new SearchRequest();
     return View(sr);
 }