Esempio n. 1
0
        public void ShouldCreateStep()
        {
            const ReservationStepType dummyStepType = (ReservationStepType)(-1);

            _subject.Execute(new List <ReservationStepType> {
                dummyStepType
            });

            A.CallTo(() => _stepFactoryDouble.CreateInstance(dummyStepType)).MustHaveHappened();
        }
Esempio n. 2
0
        public List <IReservationStep> Execute(List <ReservationStepType> reservationStepTypes)
        {
            var reservationSteps = new List <IReservationStep>();

            foreach (var reservationStepType in reservationStepTypes)
            {
                reservationSteps.Add(_stepFactory.CreateInstance(reservationStepType));
            }
            return(reservationSteps);
        }
Esempio n. 3
0
        public void ShouldRetrieveRequiredStepInputs()
        {
            const int dummyHotelId = 1;
            var       stepDouble   = A.Fake <IReservationStep>();

            A.CallTo(() => _hotelSystemDouble.GetHotelReservationSteps(A <int> ._)).Returns((new List <ReservationStepType> {
                (ReservationStepType)(-1)
            }));
            A.CallTo(() => _stepFactoryDouble.CreateInstance(A <ReservationStepType> ._)).Returns(stepDouble);

            _subject.GetRequiredStepInputsForHotelId(dummyHotelId);

            A.CallTo(() => stepDouble.GetRequiredStepInputs()).MustHaveHappened();
        }
        public void ShouldExecuteStepsForProvidedHotelId()
        {
            const int dummyHotelId     = 1;
            var       stepInputsDouble = new List <StepInput> {
                A.Fake <StepInput>()
            };
            var stepDouble = A.Fake <IReservationStep>();

            A.CallTo(() => _hotelSystemDouble.GetHotelReservationSteps(A <int> ._)).Returns((new List <ReservationStepType> {
                (ReservationStepType)(-1)
            }));
            A.CallTo(() => _stepFactoryDouble.CreateInstance(A <ReservationStepType> ._)).Returns(stepDouble);

            _subject.ReserveHotel(dummyHotelId, stepInputsDouble);

            A.CallTo(() => _stepExecutorDouble.ExecuteSteps(
                         A <List <IReservationStep> > .That.Matches(steps => steps.Contains(stepDouble)), stepInputsDouble)).MustHaveHappened();
        }
Esempio n. 5
0
 public void ShouldCreateReservationProcessStepInstance()
 {
     _subject.CreateInstance(ReservationStepType.ReservationProcess).Should().BeOfType(typeof(ReservationStartProcess));
 }