Esempio n. 1
0
        public void Then_AssigSeat_Returns_True_If_Parameters_Are_OK()
        {
            //ARRANGE
            seatToAssign.Column = "B";

            var aircraft = AircraftScenarioFactory.GetMockedAircraftWithAvailableSeats(flightNumber, departureDate);

            _IAircraftRecoverAndPersistMocked.Expects.One.Method(x => x.GetAircraftFromRepository(aircraft)).WithAnyArguments().WillReturn(aircraft);

            //ACT
            bool actual = Sut.Assign(aircraft, seatToAssign);

            //ASSERT
            Assert.IsTrue(actual, "Se esparaba una asignación de asientos sin errores cuando los parametros de entrada son correctos.");
        }
        public void Then_AssignSeat_Thrown_Exception_If_TimeSalesCloseBeforeFlight()
        {
            //ARRANGE
            string   flightNumber  = "FN1";
            DateTime departureDate = DateTime.Now;
            Seat     seatToAssign  = new Seat
            {
                Availability = AvailabilityEnum.Available,
                Column       = "B",
                Row          = "2"
            };

            var aircraft = AircraftScenarioFactory.GetMockedAircraftWithAvailableSeats(flightNumber, departureDate);

            _libraryConfigurationMocked.Expects.One.GetProperty(v => v.TimeSalesCloseBeforeFlight).WillReturn(2);
            _IAircraftRecoverAndPersistMocked.Expects.One.Method(x => x.GetAircraftFromRepository(aircraft)).WithAnyArguments().WillReturn(aircraft);

            //ACT
            Sut.Assign(aircraft, seatToAssign);

            //ASSERT
        }