public void And_ParametersOK_Then_AssigSeat_ReturnTrue()
        {
            //ARRANGE
            var aircraft = AircraftScenarioFactory.GetMockedAircraftWithAvailableSeats(flightNumber, departureDate);

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

            //ACTION
            bool actual = Sut.Unassign(aircraft, seatToUnAssign);

            //ASSERT

            Assert.IsTrue(actual, "No se esparaba error al desasignar un asiento cuando los parametros de entrada son correctos.");
        }
Exemple #2
0
        public void Then_AssigSeat_Returns_False_If_Parameters_Are_Not_OK()
        {
            //ARRANGE
            seatToAssign.Column = "";

            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.IsFalse(actual, "Se esparaba un error en la asignación de asientos cuando los parametros de entrada no 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
        }