BatchFlow.UnitTests.Helpers.GetEndpoint C# (CSharp) Метод

GetEndpoint() статический приватный Метод

static private GetEndpoint ( List output ) : EndPoint
output List
Результат EndPoint
        internal static EndPoint<string> GetEndpoint(List<string> output)
        {
            EndPoint<string> n = new EndPoint<string>(
                (string i) =>
                {
                    output.Add(i);
                    Thread.Sleep(10);
                }
                );
            return n;
        }

Usage Example

Пример #1
0
        public void ThreeStepWithInputPoint()
        {
            List <string>          results = new List <string>();
            InputPoint <int>       s       = new InputPoint <int>();
            TaskNode <int, string> filter  = Helpers.GetFilter();

            EndPoint <string> n = Helpers.GetEndpoint(results);

            Flow flow = Helpers.ConnectStartFilterEnd(s, filter, n);

            flow.Start();
            s.Send(1, 2, 3, 4, 5, 6, 7, 8);
            s.Send(new int[] { 9, 10, 11, 12, 13, 14, 15 });
            flow.RunToCompletion();
            Assert.AreEqual(4, results.Count);
            Assert.AreEqual(15, filter.ItemsProcessed);
            Assert.AreEqual(RunStatus.Running, n.Status);

            s.CloseEntrance();
            flow.RunToCompletion();
            // at this point, the flow and some nodes may still be running or stopping,
            // the data items have left the flow, but the nodes can still be in the process of stopping
            Assert.Contains(n.Status, new List <RunStatus>()
            {
                RunStatus.Running, RunStatus.Stopping, RunStatus.Stopped
            });

            // after a small wait, everything should be in the Stopped status
            Thread.Sleep(100);
            Assert.AreEqual(RunStatus.Stopped, n.Status);
        }
All Usage Examples Of BatchFlow.UnitTests.Helpers::GetEndpoint