Exemple #1
0
        public async Task The_user_should_be_pending()
        {
            var timer = Stopwatch.StartNew();

            var controller = new RegisterUserController(Bus);
            HostReceiveEndpointHandle connectReceiveEndpoint = null;

            try
            {
                connectReceiveEndpoint = Host.ConnectReceiveEndpoint(NewId.NextGuid().ToString(), x => x.Instance(controller));
                await connectReceiveEndpoint.Ready;

                bool complete = controller.RegisterUser("username", "password", "Display Name", "*****@*****.**");

                complete.ShouldBe(true); //("The user should be pending");

                timer.Stop();
                Debug.WriteLine("Time to handle message: {0}ms", timer.ElapsedMilliseconds);

                complete = controller.ValidateUser();

                complete.ShouldBe(true); //("The user should be complete");
            }
            finally
            {
                if (connectReceiveEndpoint != null)
                {
                    await connectReceiveEndpoint.StopAsync();
                }
            }
        }
Exemple #2
0
 public async Task CloseAsync(CancellationToken cancellationToken)
 {
     if (_handle != null)
     {
         await _handle.StopAsync(cancellationToken).ConfigureAwait(false);
     }
     _handle = null;
 }
        public async Task DisconnectEndpoint(HostReceiveEndpointHandle handle)
        {
            await handle.StopAsync();

            if (ActiveReceiveEndpoints.Contains(handle))
            {
                ActiveReceiveEndpoints.Remove(handle);
            }
        }
Exemple #4
0
 public void Abort()
 {
     _handle?.StopAsync().Wait(1000);
     _handle = null;
 }
 Task IAsyncDisposable.DisposeAsync(CancellationToken cancellationToken)
 {
     return(_receiveEndpointHandle.StopAsync(cancellationToken));
 }
 public async ValueTask DisposeAsync()
 {
     await _receiveEndpointHandle.StopAsync().ConfigureAwait(false);
 }