コード例 #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();
                }
            }
        }
コード例 #2
0
        public void The_user_should_be_pending()
        {
            Stopwatch timer = Stopwatch.StartNew();

            var controller = new RegisterUserController(LocalBus);

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

            Assert.That(complete, Is.False, "The user should be pending");

            timer.Stop();

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

            complete = controller.ValidateUser();

            Assert.That(complete, Is.True, "Should have been completed by now");
        }
コード例 #3
0
        public void The_user_should_be_pending()
        {
            var timer = Stopwatch.StartNew();

            var controller = new RegisterUserController(Bus);

            using (ConnectHandle unsubscribe = Bus.ConnectInstance(controller))
            {
                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");
            }
        }
コード例 #4
0
        public void The_user_should_be_pending()
        {
            Stopwatch timer = Stopwatch.StartNew();

            var controller = new RegisterUserController(LocalBus);

            using (IUnsubscribeAction unsubscribe = LocalBus.SubscribeInstance(controller).Disposable())
            {
                RemoteBus.ShouldHaveSubscriptionFor <UserRegistrationPending>();
                RemoteBus.ShouldHaveSubscriptionFor <UserRegistrationComplete>();

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

                complete.ShouldBeTrue("The user should be pending");

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

                complete = controller.ValidateUser();

                complete.ShouldBeTrue("The user should be complete");
            }
        }