Ejemplo n.º 1
0
        public void GetResultTest3()
        {
            var mockEngine = new MockSearchEngine(1);
            var mockEngine2 = new MockSearchEngine(2);
            var myTravelManager = new TravelSearchManager(new[] { mockEngine, mockEngine2 });

            var travels = new List<Travel>{
                new Travel("Budapest", "London", DateTime.Today.AddDays(3)),
                new Travel("London", "Budapest", DateTime.Today.AddDays(4)),
                new Travel("Budapest", "London", DateTime.Today.AddDays(20)),
                new Travel("London", "Budapest", DateTime.Today.AddDays(22))
            };

            foreach (var t in travels)
                myTravelManager.AddTravel(t);

            myTravelManager.StartSearch();
            var results = myTravelManager.GetResults().ToList();

            Debug.Assert(results.Count == 56 &&
                results.Count(a => a.TicketCount == 4) == 16 &&
                results.Count(a => a.TicketCount == 3) == 32 &&
                results.Count(a => a.TicketCount == 2) == 8);
        }
Ejemplo n.º 2
0
        public void GetResultTest()
        {
            var mockEngine = new MockSearchEngine(1);
            var myTravelManager = new TravelSearchManager(new[] { mockEngine });

            var travels = new List<Travel>{
                new Travel("Budapest", "London", DateTime.Today.AddDays(3)),
                new Travel("London", "Budapest", DateTime.Today.AddDays(4))
            };

            foreach (var t in travels)
                myTravelManager.AddTravel(t);

            myTravelManager.StartSearch();
            var results = myTravelManager.GetResults();

            Debug.Assert(
                results.Count == 2);
        }