public void GivenHotelInNightTime_ThenAllMainCorridorLightsShouldbeOn()
        {
            var hotel = new Hotel()
                        .With(new Floor()
                              .With(new MainCorridor()
                                    .With(new Light()
            {
                Switch = Switch.OFF
            })));


            IAction actiontobePerformed = new NightTimeAction(hotel);

            actiontobePerformed.PerformAction();

            Assert.True(hotel
                        .Floors.First()
                        .MainCorridors.First()
                        .Lights.First()
                        .Switch == Switch.ON);
        }
示例#2
0
        public IAction ProvideAction()
        {
            IAction action;

            if (_movementType == ActionType.Night)
            {
                action = new NightTimeAction();
            }
            else if (_movementType == ActionType.Day)
            {
                action = new DayTimeAction();
            }
            else if (_movementType == ActionType.Movement)
            {
                action = new MovementAction(_actionLocation, _dayNightTime);
            }
            else
            {
                action = new IdleForTwoMinuteAction(_actionLocation);
            }

            return(action);
        }