public void Execute()
 {
     var TempOperation = new Utilities.Workflow.Manager.Workflow<dynamic>("ASDF");
     TempOperation.Do(new GenericOperation<dynamic>(x => x));
     Assert.Equal(1, TempOperation.Start(1));
     Assert.Equal("A", TempOperation.Start("A"));
 }
        public void Execute()
        {
            var TempOperation = new Utilities.Workflow.Manager.Workflow <dynamic>("ASDF");

            TempOperation.Do(new GenericOperation <dynamic>(x => x));
            Assert.Equal(1, TempOperation.Start(1));
            Assert.Equal("A", TempOperation.Start("A"));
        }
        public void ExecuteFailedConstraint()
        {
            var TempOperation = new Utilities.Workflow.Manager.Workflow <dynamic>("ASDF");

            TempOperation.Do(new GenericOperation <dynamic>(x => x), new GenericConstraint <dynamic>(x => x > 1));
            Assert.Equal(1, TempOperation.Start(1));
        }
 public void ExecuteMultipleParallel()
 {
     var TempOperation = new Utilities.Workflow.Manager.Workflow<dynamic>("ASDF");
     TempOperation.Do(new GenericOperation<dynamic>(x => { x.A = 10; return x; }))
         .And(new GenericOperation<dynamic>(x => { x.B = 20; return x; }));
     dynamic Value = TempOperation.Start(new Dynamo(new { A = 1, B = 2 }));
     Assert.Equal(10, Value.A);
     Assert.Equal(20, Value.B);
 }
        public void ExecuteMultipleParallel()
        {
            var TempOperation = new Utilities.Workflow.Manager.Workflow <dynamic>("ASDF");

            TempOperation.Do(new GenericOperation <dynamic>(x => { x.A = 10; return(x); }))
            .And(new GenericOperation <dynamic>(x => { x.B = 20; return(x); }));
            dynamic Value = TempOperation.Start(new Dynamo(new { A = 1, B = 2 }));

            Assert.Equal(10, Value.A);
            Assert.Equal(20, Value.B);
        }
        public void OnException()
        {
            int Value         = 0;
            var TempOperation = new Utilities.Workflow.Manager.Workflow <dynamic>("ASDF");

            TempOperation.Do(new GenericOperation <dynamic>(x =>
            {
                throw new Exception("ASDF");
            }))
            .On <Exception>(x => Value = 1);
            Assert.Throws <AggregateException>(() => TempOperation.Start(1));
            Assert.Equal(1, Value);
        }
        public void ExecuteRetry()
        {
            var Rand          = new System.Random(1234);
            var TempOperation = new Utilities.Workflow.Manager.Workflow <dynamic>("ASDF");

            TempOperation.Do(new GenericOperation <dynamic>(x =>
            {
                if (Rand.Next(1, 3) > 1)
                {
                    throw new Exception("ASDF");
                }
                return(x);
            }));
            TempOperation.Retry(10000);
            Assert.Equal(1, TempOperation.Start(1));
        }
 public void ExecuteTrueConstraint()
 {
     var TempOperation = new Utilities.Workflow.Manager.Workflow<dynamic>("ASDF");
     TempOperation.Do(new GenericOperation<dynamic>(x => x + 1), new GenericConstraint<dynamic>(x => x > 1));
     Assert.Equal(3, TempOperation.Start(2));
 }
 public void ExecuteRetry()
 {
     var Rand = new System.Random(1234);
     var TempOperation = new Utilities.Workflow.Manager.Workflow<dynamic>("ASDF");
     TempOperation.Do(new GenericOperation<dynamic>(x =>
     {
         if (Rand.Next(1, 3) > 1)
             throw new Exception("ASDF");
         return x;
     }));
     TempOperation.Retry(10000);
     Assert.Equal(1, TempOperation.Start(1));
 }
Exemplo n.º 10
0
 public void OnException()
 {
     int Value = 0;
     var TempOperation = new Utilities.Workflow.Manager.Workflow<dynamic>("ASDF");
     TempOperation.Do(new GenericOperation<dynamic>(x =>
     {
         throw new Exception("ASDF");
     }))
     .On<Exception>(x => Value = 1);
     Assert.Throws<AggregateException>(() => TempOperation.Start(1));
     Assert.Equal(1, Value);
 }