Beispiel #1
0
        public void Should_be_possible()
        {
            LocalBus.HasSubscription <IBusinessCommand>(8.Seconds()).Any().ShouldBeTrue();
            RemoteBus.HasSubscription <ISecureCommand <IBusinessCommand> >(8.Seconds()).Any().ShouldBeTrue();

            RemoteBus.Publish(new BusinessCommand
            {
                SqlText = "DROP TABLE [Users]",
            });

            CommandHandler.CommandReceived.IsAvailable(8.Seconds()).ShouldBeTrue();
        }
Beispiel #2
0
        void Publish <T>(T message)
            where T : class
        {
            LocalBus.HasSubscription <T>().Any()
            .ShouldBeTrue("Message subscription was not found");
            LocalBus.HasSubscription <WorkerAvailable <T> >().Any()
            .ShouldBeTrue("Worker available subscription was not found.");
            RemoteBus.HasSubscription <Distributed <T> >().Any()
            .ShouldBeTrue("Message subscription was not found");

            LocalBus.Endpoint.Send(message, context => { context.SendResponseTo(LocalBus); });
        }
Beispiel #3
0
        public void Should_be_possible()
        {
            RemoteBus.HasSubscription <ISecureCommand>(8.Seconds()).Any().ShouldBeTrue();

            RemoteBus.Publish(new CommandAndCredentials
            {
                SqlText  = "DROP TABLE [Users]",
                Username = "******",
                Password = "******",
            });

            CommandHandler.CredentialsReceived.IsAvailable(8.Seconds()).ShouldBeTrue();
        }
        public void The_message_should_be_delivered_to_a_remote_subscriber()
        {
            var updated = new Future <UpdateMessage>();

            LocalBus.SubscribeHandler <UpdateMessage>(updated.Complete);

            RemoteBus.HasSubscription <UpdateMessage>().Count().ShouldBeGreaterThan(0);

            var um = new UpdateMessage();

            RemoteBus.Publish(um);

            updated.WaitUntilCompleted(8.Seconds()).ShouldBeTrue("Update not received");
        }
        public void The_message_should_be_delivered_to_a_remote_subscriber_with_a_reply()
        {
            var updated        = new Future <UpdateMessage>();
            var updateAccepted = new Future <UpdateAcceptedMessage>();

            RemoteBus.SubscribeContextHandler <UpdateMessage>(context =>
            {
                updated.Complete(context.Message);

                context.Respond(new UpdateAcceptedMessage());
            });

            LocalBus.HasSubscription <UpdateMessage>().Count().ShouldBeGreaterThan(0);

            LocalBus.SubscribeHandler <UpdateAcceptedMessage>(updateAccepted.Complete);
            RemoteBus.HasSubscription <UpdateAcceptedMessage>().Count().ShouldBeGreaterThan(0);

            var um = new UpdateMessage();

            LocalBus.Publish(um);

            updated.WaitUntilCompleted(8.Seconds()).ShouldBeTrue("Update not received");
            updateAccepted.WaitUntilCompleted(8.Seconds()).ShouldBeTrue("Update accepted not received");
        }
Beispiel #6
0
 public void Should_have_the_subscription_for_the_ping_worker()
 {
     RemoteBus.HasSubscription <PingWorker>().Any()
     .ShouldBeTrue("PingWorker subscription was not found.");
 }
 public void Should_have_the_subscription_for_the_distributed_message()
 {
     RemoteBus.HasSubscription <Distributed <A> >().Any()
     .ShouldBeTrue("Message subscription was not found");
 }