Exemplo n.º 1
0
 public void CanChainTasksWithoutEndWithAndThrowException()
 {
     using (var c = new ChainedOperation())
     {
         c.BeginWith(First) // first action
             .Then(Second) // second action
             .Then(Third) // third action
             .Then(Fourth); // fourth action
     }
 }
Exemplo n.º 2
0
 public void CanChainTasks()
 {
     using (var c = new ChainedOperation())
     {
         c.BeginWith(First) // first action
             .Then(Second) // second action
             .Then(Third) // third action
             .Then(Fourth) // fourth action
             .EndWith(e =>
             {
                 if (e != null)
                 {
                     Trace.TraceError("An exception ocurred!");
                 }
             });
     }
 }
Exemplo n.º 3
0
 static void ThirdAsync(ChainedOperation c)
 {
     Task.Factory.StartNew(() =>
     {
         //throw new Exception("Wakka");
         Trace.TraceInformation("Third (TID: {0})", Thread.CurrentThread.ManagedThreadId);
         c.Pass();
         //c.Fail();
     });
 }
Exemplo n.º 4
0
 static void SecondAsync(ChainedOperation c)
 {
     Task.Factory.StartNew(() =>
     {
         Trace.TraceInformation("Second (TID: {0})", Thread.CurrentThread.ManagedThreadId);
         c.Pass();
     });
 }
Exemplo n.º 5
0
 static void Third(ChainedOperation c)
 {
     // throw new Exception("Wakka");
     Trace.WriteLine("Third");
     c.Pass();
 }
Exemplo n.º 6
0
 static void Second(ChainedOperation c)
 {
     Trace.WriteLine("Second");
     c.Pass();
 }
Exemplo n.º 7
0
 static void Fourth(ChainedOperation c)
 {
     Trace.WriteLine("Fourth");
     c.Pass();
 }
Exemplo n.º 8
0
 static void First(ChainedOperation c)
 {
     Trace.WriteLine("First");
     c.Pass();
 }
Exemplo n.º 9
0
 static void CauseExceptionAsync(ChainedOperation c)
 {
     Task.Factory.StartNew(() =>
     {
         throw new Exception("Boom!!!!");
     });
 }
Exemplo n.º 10
0
 static void CauseException(ChainedOperation c)
 {
     throw new Exception("Boom!!!!");
 }