コード例 #1
0
        public void CanTrigger_InitialStateIsOff_CanTriggerToStateOn()
        {
            // Arrange
            Switcher switcher = new Switcher
            {
                Type = OnOffWorkflow.TYPE
            };

            WorkflowExecution execution = new WorkflowExecution(new OnOffWorkflow());

            // Act
            TriggerResult result = execution.CanTrigger(new TriggerParam("SwitchOn", switcher));

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(true, result.CanTrigger);
        }
コード例 #2
0
        public void CanTrigger_InitialStateIsOff_CanNotTriggerToStateOn()
        {
            // Arrange
            Switcher switcher = new Switcher
            {
                Type = OnOffWorkflow.TYPE
            };

            WorkflowExecution execution = new WorkflowExecution(new OnOffWorkflow());

            var variables = new Dictionary <string, WorkflowVariableBase>();
            var variable  = new SwitcherWorkflowVariable(false);

            variables.Add(SwitcherWorkflowVariable.KEY, variable);
            var triggerParam = new TriggerParam("SwitchOn", switcher, variables);

            // Act
            TriggerResult result = execution.CanTrigger(triggerParam);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(false, result.CanTrigger);
        }