Start() private method

private Start ( ) : void
return void
Exemplo n.º 1
0
        async Task Run(ClientAndServerParameters parameters)
        {
            if (Configuration.EnableDebugging)
            {
                parameters.EnableDebugging = true;
            }
            var connection = await Factory.Start(parameters);

            connection.Dispose();
        }
        public void Initalize()
        {
            MockActionInvoker.Reset();
            MockWorkerHandler.Reset();

            DispatcherToken = Factory.Start(new ActionDispatcherSettings
            {
                Timeout = TimeSpan.FromSeconds(0.1)
            });

            DispatcherToken.Post(t => Task.Delay(10000, t));
        }
Exemplo n.º 3
0
        public void Initalize()
        {
            DispatcherToken = Factory.Start(new ActionDispatcherSettings
            {
                Timeout = TimeSpan.FromSeconds(1000)
            });

            MockActionInvoker.Invocations.Clear();

            Chain = DispatcherToken.Chain()
                    .Post(MockActionInvoker.Object)
                    .Post(MockActionInvoker.Object);
        }
        public void Initalize()
        {
            MockWorkerHandler.Invocations.Clear();
            MockActionInvoker.Invocations.Clear();

            DispatcherToken = Factory.Start(new ActionDispatcherSettings
            {
                Timeout = TimeSpan.FromSeconds(1)
            });

            DispatcherToken.Post(MockActionInvoker.Object);
            DispatcherToken.Post(p => throw new ArgumentException());
            DispatcherToken.Post(MockActionInvoker.Object);
        }
Exemplo n.º 5
0
        public void Initalize()
        {
            DispatcherToken = Factory.Start(new ActionDispatcherSettings
            {
                Timeout = TimeSpan.FromSeconds(1000)
            });

            MockActionInvoker.Invocations.Clear();

            MockActionInvokerError.Setup(p => p.Invoke(It.IsAny <CancellationToken>())).ThrowsAsync(new ArgumentException("test"));

            Chain = DispatcherToken.Chain()
                    .Post(MockActionInvoker.Object)
                    .Post(MockActionInvoker.Object)
                    .Post(MockActionInvokerError.Object);
        }
Exemplo n.º 6
0
        public void Initalize()
        {
            DispatcherToken = Factory.Start(new ActionDispatcherSettings
            {
                Timeout = TimeSpan.FromSeconds(100)
            });

            _batchToken = DispatcherToken.Plugin.Batch(p =>
            {
                p.For <SomeBatchData>()
                .MaxCount(MAX_COUNT_ITEMS)
                .TriggerCount(MAX_COUNT_ITEMS)
                .FlushOnStop(true)
                .Bind(() => BatchActionInvoker.Object);
            }).Start();
        }
Exemplo n.º 7
0
        public void Initalize()
        {
            Callback = (WorkerCompletedData p) => MockCompleted.Object.Invoke(p, CancellationToken.None);

            MockCompleted.Setup(p => p.Invoke(It.IsAny <WorkerCompletedData>(), It.IsAny <CancellationToken>()));

            DispatcherToken = Factory.Start(new ActionDispatcherSettings
            {
                Timeout = TimeSpan.FromSeconds(1000)
            });

            MockActionInvoker.Invocations.Clear();
            MockCompleted.Invocations.Clear();

            DispatcherToken.Chain()
            .Post(MockActionInvoker.Object)
            .Post(MockActionInvoker.Object)
            .Run(Callback);
        }
Exemplo n.º 8
0
 async Task Run(ClientAndServerParameters parameters, Action <ClientAndServer> action = null)
 {
     try {
         if (Configuration.EnableDebugging)
         {
             parameters.EnableDebugging = true;
         }
         using (var connection = (ClientAndServer)await Factory.Start(parameters)) {
             if (action != null)
             {
                 action(connection);
             }
             var handler = ConnectionHandlerFactory.HandshakeAndDone.Create(connection);
             await handler.Run();
         }
     } catch (Exception ex) {
         DebugHelper.WriteLine("ERROR: {0} {1}", ex.GetType(), ex);
         throw;
     }
 }
Exemplo n.º 9
0
        async Task Run(MyFlags flags, Type expectedException = null, ClientAndServerParameters parameters = null, Action <ClientAndServer> action = null)
        {
            if (parameters == null)
            {
                parameters = GetDefaultParameters();
            }

            try {
                if (Configuration.EnableDebugging)
                {
                    parameters.EnableDebugging = true;
                }
                using (var connection = (ClientAndServer)await Factory.Start(parameters)) {
                    if (action != null)
                    {
                        action(connection);
                    }
                    var handler = new MyConnectionHandler(connection, flags);
                    await handler.Run();
                }
                if (expectedException != null)
                {
                    Assert.Fail("Expected an exception of type {0}", expectedException);
                }
            } catch (Exception ex) {
                if (expectedException != null)
                {
                    Assert.That(ex, Is.InstanceOf(expectedException));
                }
                else
                {
                    DebugHelper.WriteLine("ERROR: {0} {1}", ex.GetType(), ex);
                    throw;
                }
            }
        }
Exemplo n.º 10
0
 private static void Main()
 {
     Factory.Start();
 }