/// <summary>
 /// Attempt to stop ongoing Async workflow
 /// </summary>
 public void StopAsync()
 {
     if (iterator != null)
     {
         iterator.Cancel();
     }
 }
Exemplo n.º 2
0
        public void ShouldStopWhenAskedToBeCancled()
        {
            ExecutionNode node = ExecutionNode.CreateLevelOneNode(1000000);

            node.AddTable(new TableEntity("", ""));

            var tables = new List <ExecutionTable>();

            NodeIterator iterator = new NodeIterator(node);
            Action       a        = new Action(() =>
            {
                tables.AddRange(iterator.GetTablesRecursive());
            });

            a.BeginInvoke(null, null);
            Thread.Sleep(10);
            iterator.Cancel();
            Console.WriteLine(tables.Count);
            Assert.That(tables.Count, Is.LessThan(1000000));
            Assert.That(tables.Count, Is.GreaterThan(0));
        }