Пример #1
0
        public void GivenHotelInNightTime_WithSubCorridorACOnandLightsOff_WhenIdealForAMin_ThenSubCorridorLightsShouldbeOff()
        {
            var hotel = new Hotel()
                        .With(new Floor()
                              .With(new MainCorridor()
                                    .With(new Light())
                                    .With(new AC()))
                              .With(new SubCorridor()
                                    .With(new Light()
            {
                Switch = Switch.ON
            })
                                    .With(new AC()
            {
                Switch = Switch.ON
            })));

            SwitchedOffAcs.Stack.Clear();
            IAction actiontobePerformed = new IdleForTwoMinuteAction(hotel, new ActionLocation(1, 1));

            actiontobePerformed.PerformAction();

            Assert.True(hotel
                        .Floors.First()
                        .SubCorridors.First()
                        .Lights.First()
                        .Switch == Switch.OFF);
        }
Пример #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);
        }