コード例 #1
0
        public SecretPanelSemanticModel()
        {
            _doorOpened = new Event("DoorOpened", "D1OP");
            _doorClosed = new Event("DoorClosed", "D1CL");
            _drawerOpened = new Event("DrawerOpened", "D2OP");
            _lightOn = new Event("LightOn", "L1ON");
            _panelClosed = new Event("PanelClosed", "PNCL");

            _lockPanelCmd = new Command("LockPanel", "PNLK");
            _unlockPanelCmd = new Command("UnlockPanel", "PNUL");
            _lockDoorCmd = new Command("LockDoor", "D1LK");
            _unlockDoorCmd = new Command("UnlockDoor", "D1UL");

            _idleState = new State("Idle");
            _activeState = new State("Active");
            _waitingForLightState = new State("WaitingForLight");
            _waitingForDrawerState = new State("WaitingForDrawer");
            _unlockedPanelState = new State("UnlockedPanel");

            SetupTransitions();
        }
コード例 #2
0
ファイル: StateTests.cs プロジェクト: ChristopherWolf/DSLFun
		public void ItShouldAddThePassedInCommandAsAnAction(ICommandChannel commandChannel, Command command, State sut)
		{
			// Arrange

			// Act
			sut.AddAction(command);

			sut.ExecuteActions(commandChannel);

			// Assert
			A.CallTo(() => commandChannel.Send(command.Code)).MustHaveHappened(Repeated.Exactly.Once);
		}
コード例 #3
0
ファイル: State.cs プロジェクト: ChristopherWolf/DSLFun
        public void AddAction(Command command)
        {
            if (command == null) throw new ArgumentNullException("command");

            _actions.Add(command);
        }