예제 #1
0
        public void HandleError_ErrorHandledDepartureDateIsBiggerThanReturningDate_ReturnsNothing()
        {
            var presenter = new AvailabiltyPresenter
            {
                View = new AvailabilityMockUpView
                {
                    AdultsPassangers = 1,
                    DepartureDate    = DateTime.Now,
                    ReturningDate    = DateTime.Now.AddDays(-3),
                    DepartureStation = "MEX",
                    ArrivalStation   = "CUN",
                    IsRoundTrip      = true
                },
                Repository = new AvailabilityRepository()
            };

            var errorController = new AvailabilityErrorControllerMockUp();

            try
            {
                presenter.SearchFlights();
            }
            catch (Exception exe)
            {
                errorController.HandleError(exe);
            }

            Assert.IsTrue(errorController.ErrorWasHandled, "El error no fue controlado por el controlador de errores.");
        }
예제 #2
0
        public void HandleError_ErrorHandledGenericExceptionThrowed_ReturnsNothing()
        {
            var presenter = new AvailabiltyPresenter
            {
                View = new AvailabilityMockUpView
                {
                    AdultsPassangers = 1,
                    DepartureDate    = DateTime.Now,
                    ReturningDate    = DateTime.Now.AddDays(2),
                    DepartureStation = "MEX",
                    ArrivalStation   = "CUN",
                    IsRoundTrip      = true
                },
                Repository = new AvailabilityRepository()
            };

            var errorController = new AvailabilityErrorControllerMockUp();

            try
            {
                throw new Exception("No se quien soy?¿");
            }
            catch (Exception exe)
            {
                errorController.HandleError(exe);
            }

            Assert.IsFalse(errorController.ErrorWasHandled, "El error no fue controlado por el controlador de errores.");
        }