public void Cannot_Create_StateDefinitions_with_similar_StatePosition()
 {
     var definition = new XStateMachineDefinition<string, int, int>();
     definition.Add(new XStatePosition<string, int, int>(string.Empty, 1, 0), new XStateAction<string>("", nextState =>
     {
         System.Diagnostics.Debug.WriteLine("I am now at state:" + nextState);
     }));
     definition.Add(new XStatePosition<string, int, int>(string.Empty, 1, 0), new XStateAction<string>("", nextState =>
     {
         System.Diagnostics.Debug.WriteLine("I am now at state:" + nextState);
     }));
     Assert.IsFalse(definition.IsEmpty());
 }
 public void Create_StateDefinitions_with_null_Command_will_throws_exception()
 {
     var definition = new XStateMachineDefinition<string, string, string>();
     definition.Add(new XStatePosition<string, string, string>("", "", null), new XStateAction<string>("", nextState =>
     {
         System.Diagnostics.Debug.WriteLine("I am now at state:" + nextState);
     }));
     Assert.IsFalse(definition.IsEmpty());
 }
        public void Can_Create_StateDefinitions_with_Integers()
        {
            var definition = new XStateMachineDefinition<int, int, int>();
            definition.Add(new XStatePosition<int, int, int>(0, 0, 0), new XStateAction<int>(1, nextState =>
            {
                System.Diagnostics.Debug.WriteLine("I am now at state:" + nextState);
            }));

            Assert.IsFalse(definition.IsEmpty());
        }
예제 #4
0
        private XStateMachineDefinition<int, int, int> MakeSampleStateMachineDefinitions()
        {
            XStateMachineDefinition<int, int, int> definitions = new XStateMachineDefinition<int, int, int>();

            definitions.Add(new XStatePosition<int, int, int>(1, 2, 3), new XStateAction<int>(10, x => { }));

            definitions.Add(new XStatePosition<int, int, int>(2, 2, 3), new XStateAction<int>(20, x =>
            {
                var isExecuted = true;
                Assert.IsTrue(isExecuted);
            }));

            return definitions;
        }
예제 #5
0
        private XStateMachineDefinition<string, string, string> MakeSampleApprovalStateMachineDefinitions()
        {
            XStateMachineDefinition<string, string, string> definitions = new XStateMachineDefinition<string, string, string>();

            definitions.Add(new XStatePosition<string, string, string>("pending-for-approval", "approver", "reject-request"), new XStateAction<string>("rejected", x => { }));

            definitions.Add(new XStatePosition<string, string, string>("pending-for-approval", "requester", "cancel-request"), new XStateAction<string>("draft", x => { }));

            definitions.Add(new XStatePosition<string, string, string>("draft", "requester", "submit-for-approval"), new XStateAction<string>("pending-for-approval", x =>
            {
                var isExecuted = true;
                Assert.IsTrue(isExecuted);
            }));

            return definitions;
        }