public async Task Should_connect_with_credentials()
        {
            var busControl = Bus.Factory.CreateUsingAmazonSqs(cfg =>
            {
                BusTestFixture.ConfigureBusDiagnostics(cfg);

                cfg.Host(new Uri("amazonsqs://localhost:4566"), h =>
                {
                    h.AccessKey("admin");
                    h.SecretKey("admin");
                    h.Config(new AmazonSimpleNotificationServiceConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                    h.Config(new AmazonSQSConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                });
            });

            try
            {
                await busControl.StartAsync();
            }
            finally
            {
                await busControl.StopAsync();
            }
        }
Exemple #2
0
        public async Task Should_recover_from_a_crashed_server()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);

                x.ReceiveEndpoint("input-queue", e =>
                {
                });
            });

            var handle = await busControl.StartAsync();

            try
            {
                Console.WriteLine("Waiting for connection...");

                await handle.Ready;

                await Task.Delay(30000);
            }
            finally
            {
                await handle.StopAsync();
            }
        }
Exemple #3
0
        public async Task Should_startup_and_shut_down_cleanly_with_an_endpoint()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);

                x.Host(new Uri("rabbitmq://localhost/"), h =>
                {
                });

                x.ReceiveEndpoint("input_queue", e =>
                {
                    e.Handler <Test>(async context =>
                    {
                    });
                });
            });

            var handle = await busControl.StartAsync(TestCancellationToken);

            try
            {
                Console.WriteLine("Waiting for connection...");

                await handle.Ready;

                await Task.Delay(60000);
            }
            finally
            {
                await handle.StopAsync(TestCancellationToken);
            }
        }
            public async Task Should_not_create_bus_endpoint_queue_on_startup()
            {
                ServiceBusTokenProviderSettings settings = new TestAzureServiceBusAccountSettings();

                var serviceUri = AzureServiceBusEndpointUriCreator.Create(Configuration.ServiceNamespace);

                var bus = Bus.Factory.CreateUsingAzureServiceBus(x =>
                {
                    BusTestFixture.ConfigureBusDiagnostics(x);
                    x.Host(serviceUri, h => h.SharedAccessSignature(s =>
                    {
                        s.KeyName         = settings.KeyName;
                        s.SharedAccessKey = settings.SharedAccessKey;
                        s.TokenTimeToLive = settings.TokenTimeToLive;
                        s.TokenScope      = settings.TokenScope;
                    }));
                });

                var busHandle = await bus.StartAsync();

                try
                {
                }
                finally
                {
                    await busHandle.StopAsync();
                }
            }
Exemple #5
0
        public async Task Should_fault_nicely()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);

                x.Host(new Uri("rabbitmq://unknownhost:32787"), h =>
                {
                    h.Username("whocares");
                    h.Password("Ohcrud");
                    h.RequestedConnectionTimeout(2000);
                });

                x.AutoStart = true;
            });

            Assert.ThrowsAsync <RabbitMqConnectionException>(async() =>
            {
                BusHandle handle;
                using (var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(10)))
                {
                    handle = await busControl.StartAsync(timeout.Token).OrCanceled(TestCancellationToken);
                }

                await handle.StopAsync(CancellationToken.None);
            });
        }
Exemple #6
0
        public async Task Should_fault_with_operation_cancelled_on_publish()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);

                x.Host("unknown_host");

                x.AutoStart = true;
            });

            using var startTimeout = new CancellationTokenSource(TimeSpan.FromSeconds(20));

            var startTask = busControl.StartAsync(startTimeout.Token).OrCanceled(TestCancellationToken);

            var publishTimer = Stopwatch.StartNew();

            Assert.ThrowsAsync <OperationCanceledException>(async() =>
            {
                using var publishTimeout = new CancellationTokenSource(TimeSpan.FromSeconds(10));

                await busControl.Publish(new PingMessage(), publishTimeout.Token);
            });

            publishTimer.Stop();
            var publishElapsed = publishTimer.Elapsed;

            Assert.That(publishElapsed, Is.LessThan(TimeSpan.FromSeconds(19)));

            Assert.ThrowsAsync <RabbitMqConnectionException>(async() =>
            {
                await startTask;
            });
        }
Exemple #7
0
        public async Task Should_fault_when_credentials_are_bad()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);

                x.Host(new Uri("rabbitmq://localhost/"), h =>
                {
                    h.Username("guest");
                    h.Password("guessed");
                });
            });

            Assert.That(async() =>
            {
                var handle = await busControl.StartAsync();
                try
                {
                    Console.WriteLine("Waiting for connection...");

                    await handle.Ready;
                }
                finally
                {
                    await handle.StopAsync();
                }
            }, Throws.TypeOf <RabbitMqConnectionException>());
        }
        public async Task Should_not_timeout()
        {
            var harness = new InMemoryTestHarness();

            var machine = new TestSagaStateMachine();

            StateMachineSagaTestHarness <TestSaga, TestSagaStateMachine> sagaHarness = harness.StateMachineSaga <TestSaga, TestSagaStateMachine>(machine);

            harness.TestTimeout     = TimeSpan.FromSeconds(15);
            harness.OnConfigureBus += x => BusTestFixture.ConfigureBusDiagnostics(x);
            await harness.Start();

            // Act
            try
            {
                IRequestClient <StartCommand>   client   = harness.CreateRequestClient <StartCommand>();
                Response <StartCommandResponse> response = await client.GetResponse <StartCommandResponse>(
                    new
                {
                    CorrelationId = InVar.Id,
                });

                // Assert
                // did the actual saga consume the message
                Assert.True(await sagaHarness.Consumed.Any <StartCommand>());
            }
            finally
            {
                await harness.Stop();
            }
        }
            public async Task Should_support_the_new_syntax()
            {
                ServiceBusTokenProviderSettings settings = new TestAzureServiceBusAccountSettings();
                var serviceBusNamespace = Configuration.ServiceNamespace;

                var serviceUri = AzureServiceBusEndpointUriCreator.Create(
                    serviceBusNamespace,
                    "MassTransit.Azure.ServiceBus.Core.Tests"
                    );

                TaskCompletionSource <A> completed = TaskUtil.GetTask <A>();

                var bus = Bus.Factory.CreateUsingAzureServiceBus(x =>
                {
                    BusTestFixture.ConfigureBusDiagnostics(x);

                    x.Host(serviceUri, h =>
                    {
                        h.SharedAccessSignature(s =>
                        {
                            s.KeyName         = settings.KeyName;
                            s.SharedAccessKey = settings.SharedAccessKey;
                            s.TokenTimeToLive = settings.TokenTimeToLive;
                            s.TokenScope      = settings.TokenScope;
                        });
                    });

                    x.ReceiveEndpoint("input_queue", e =>
                    {
                        e.PrefetchCount = 16;

                        e.Handler <A>(async context => completed.TrySetResult(context.Message));

                        // Add a message handler and configure the pipeline to retry the handler
                        // if an exception is thrown
                        e.Handler <A>(Handle, h =>
                        {
                            h.UseRetry(r => r.Interval(5, 100));
                        });
                    });
                });

                var busHandle = await bus.StartAsync(TestCancellationToken);

                try
                {
                }
                finally
                {
                    await busHandle.StopAsync();
                }

                //                }))
                //                {
                //                    var queueAddress = new Uri(hostAddress, "input_queue");
                //                    ISendEndpoint endpoint = bus.GetSendEndpoint(queueAddress);
                //
                //                    await endpoint.Send(new A());
                //                }
            }
        public async Task Should_succeed_and_connect_when_properly_configured()
        {
            var received = new TaskCompletionSource <bool>();

            var busControl = Bus.Factory.CreateUsingAmazonSqs(cfg =>
            {
                BusTestFixture.ConfigureBusDiagnostics(cfg);

                cfg.Host(new Uri("amazonsqs://localhost:4566"), h =>
                {
                    h.AccessKey("admin");
                    h.SecretKey("admin");
                    h.Config(new AmazonSimpleNotificationServiceConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                    h.Config(new AmazonSQSConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                });

                cfg.ReceiveEndpoint("input-queue", x =>
                {
                    x.Handler <PingMessage>(async context =>
                    {
                        await context.Publish(new PongMessage(context.Message.CorrelationId));
                    });
                });

                cfg.ReceiveEndpoint("input-queue-too", x =>
                {
                    x.Handler <PongMessage>(async context =>
                    {
                        received.TrySetResult(true);

                        await TaskUtil.Completed;
                    });
                });
            });

            await busControl.StartAsync();

            try
            {
                await busControl.Publish(new PingMessage());

                await received.Task.OrTimeout(TimeSpan.FromSeconds(30));
            }
            finally
            {
                await busControl.StopAsync();
            }
        }
            public async Task Should_create_receive_endpoint_and_start()
            {
                ServiceBusTokenProviderSettings settings = new TestAzureServiceBusAccountSettings();

                Uri serviceUri = AzureServiceBusEndpointUriCreator.Create(Configuration.ServiceNamespace);

                TaskCompletionSource <PingMessage> handled = new TaskCompletionSource <PingMessage>();

                IBusControl bus = Bus.Factory.CreateUsingAzureServiceBus(x =>
                {
                    BusTestFixture.ConfigureBusDiagnostics(x);
                    x.Host(serviceUri, h =>
                    {
                    #if NET461
                        h.TransportType = TransportType.AmqpWebSockets;
                    #endif
                        h.SharedAccessSignature(s =>
                        {
                            s.KeyName         = settings.KeyName;
                            s.SharedAccessKey = settings.SharedAccessKey;
                            s.TokenTimeToLive = settings.TokenTimeToLive;
                            s.TokenScope      = settings.TokenScope;
                        });
                    });

                    x.ReceiveEndpoint("test-input-queue", e =>
                    {
                        e.Handler <PingMessage>(async context =>
                        {
                            handled.TrySetResult(context.Message);
                        });
                    });
                });

                BusHandle busHandle = await bus.StartAsync();

                try
                {
                    var endpoint = await bus.GetSendEndpoint(new Uri("queue:test-input-queue"));

                    await endpoint.Send(new PingMessage());

                    await handled.Task.OrTimeout(TimeSpan.FromSeconds(10000));
                }
                finally
                {
                    await busHandle.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token);
                }
            }
Exemple #12
0
        public async Task Should_create_receive_endpoint_and_start()
        {
            ServiceBusTokenProviderSettings settings = new TestAzureServiceBusAccountSettings();

            var serviceUri = AzureServiceBusEndpointUriCreator.Create(Configuration.ServiceNamespace);

            var handled = new TaskCompletionSource <PingMessage>();

            var bus = Bus.Factory.CreateUsingAzureServiceBus(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);
                x.Host(serviceUri, h =>
                {
                    h.SharedAccessSignature(s =>
                    {
                        s.KeyName         = settings.KeyName;
                        s.SharedAccessKey = settings.SharedAccessKey;
                        s.TokenTimeToLive = settings.TokenTimeToLive;
                        s.TokenScope      = settings.TokenScope;
                    });
                });

                x.ReceiveEndpoint(e =>
                {
                    e.RemoveSubscriptions = true;

                    e.Handler <PingMessage>(async context =>
                    {
                        await Task.Delay(TimeSpan.FromSeconds(1));

                        handled.TrySetResult(context.Message);
                    });
                });
            });

            var busHandle = await bus.StartAsync();

            try
            {
                await bus.Publish(new PingMessage());

                await handled.Task.OrTimeout(TimeSpan.FromSeconds(10000));
            }
            finally
            {
                await busHandle.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token);
            }
        }
Exemple #13
0
        public async Task Should_start_without_any_configuration()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);
            });

            var handle = await busControl.StartAsync(new CancellationTokenSource(5000).Token);

            try
            {
                await handle.Ready;
            }
            finally
            {
                await handle.StopAsync();
            }
        }
Exemple #14
0
        public async Task Should_startup_and_shut_down_cleanly()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x => BusTestFixture.ConfigureBusDiagnostics(x));

            BusHandle handle;

            using (var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30)))
            {
                handle = await busControl.StartAsync(timeout.Token);
            }

            try
            {
                await handle.Ready;
            }
            finally
            {
                await handle.StopAsync(CancellationToken.None);
            }
        }
        public async Task Should_do_a_bunch_of_requests_and_responses()
        {
            var bus = Bus.Factory.CreateUsingAmazonSqs(sbc =>
            {
                BusTestFixture.ConfigureBusDiagnostics(sbc);

                sbc.Host(new Uri("amazonsqs://localhost:4566"), h =>
                {
                    h.AccessKey("admin");
                    h.SecretKey("admin");
                    h.Config(new AmazonSimpleNotificationServiceConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                    h.Config(new AmazonSQSConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                });

                sbc.ReceiveEndpoint("test", e =>
                {
                    e.Handler <PingMessage>(async context =>
                    {
                        await context.RespondAsync(new PongMessage(context.Message.CorrelationId));
                    });
                });
            });

            await bus.StartAsync();

            try
            {
                for (var i = 0; i < 100; i += 1)
                {
                    Response <PongMessage> result = await bus.Request <PingMessage, PongMessage>(new PingMessage(), timeout : TimeSpan.FromSeconds(60));
                }
            }
            finally
            {
                await bus.StopAsync();
            }
        }
        public async Task Using_DI_should_not_timeout()
        {
            var provider = new ServiceCollection()
                           .AddMassTransitInMemoryTestHarness(cfg =>
            {
                cfg.AddSagaStateMachine <TestSagaStateMachine, TestSaga>()
                .InMemoryRepository();

                cfg.AddSagaStateMachineTestHarness <TestSagaStateMachine, TestSaga>();
                cfg.AddPublishMessageScheduler();
                cfg.AddRequestClient <StartCommand>();
            })
                           .BuildServiceProvider(true);

            var harness = provider.GetRequiredService <InMemoryTestHarness>();

            harness.TestTimeout     = TimeSpan.FromSeconds(15);
            harness.OnConfigureBus += x => BusTestFixture.ConfigureBusDiagnostics(x);
            await harness.Start();

            // Act
            try
            {
                using var scope = provider.CreateScope();
                IRequestClient <StartCommand>   client   = scope.ServiceProvider.GetRequiredService <IRequestClient <StartCommand> >();
                Response <StartCommandResponse> response = await client.GetResponse <StartCommandResponse>(
                    new
                {
                    CorrelationId = InVar.Id,
                });

                // Assert
                // did the actual saga consume the message
                var sagaHarness = provider.GetRequiredService <IStateMachineSagaTestHarness <TestSaga, TestSagaStateMachine> >();
                Assert.True(await sagaHarness.Consumed.Any <StartCommand>());
            }
            finally
            {
                await harness.Stop();
            }
        }
Exemple #17
0
        public async Task Should_startup_and_shut_down_cleanly_with_publish()
        {
            var busControl = Bus.Factory.CreateUsingRabbitMq(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);

                x.Host(new Uri("rabbitmq://localhost/"), h =>
                {
                });
            });

            await busControl.StartAsync();

            try
            {
                await busControl.Publish(new TestMessage());
            }
            finally
            {
                await busControl.StopAsync();
            }
        }
Exemple #18
0
        public async Task Should_start_and_stop_sync()
        {
            var queueUri = new Uri("rabbitmq://localhost/test/input_queue2");

            var rabbitMqHostSettings = queueUri.GetHostSettings();
            var receiveSettings      = queueUri.GetReceiveSettings();

            var bus = Bus.Factory.CreateUsingRabbitMq(sbc =>
            {
                BusTestFixture.ConfigureBusDiagnostics(sbc);

                sbc.Host(rabbitMqHostSettings);
                sbc.ReceiveEndpoint(receiveSettings.QueueName, ep =>
                {
                });
            });

            bus.Start();
            await bus.Publish(new DummyMessage { ID = 1 }).ConfigureAwait(false);

            bus.Stop();
        }
Exemple #19
0
        public async Task Should_recreate_the_subscription()
        {
            ServiceBusTokenProviderSettings settings = new TestAzureServiceBusAccountSettings();
            var serviceUri = AzureServiceBusEndpointUriCreator.Create(Configuration.ServiceNamespace);
            var busControl = Bus.Factory.CreateUsingAzureServiceBus(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);
                x.Host(serviceUri, h =>
                {
                    h.SharedAccessSignature(s =>
                    {
                        s.KeyName         = settings.KeyName;
                        s.SharedAccessKey = settings.SharedAccessKey;
                        s.TokenTimeToLive = settings.TokenTimeToLive;
                        s.TokenScope      = settings.TokenScope;
                    });
                });

                x.SubscriptionEndpoint("input-subscription", "input-topic", e =>
                {
                });
            });

            var handle = await busControl.StartAsync();

            try
            {
                Console.WriteLine("Waiting for connection...");

                await handle.Ready;

                await Task.Delay(40000);
            }
            finally
            {
                await handle.StopAsync();
            }
        }
        public async Task Should_create_queue_with_multiple_subscriptions()
        {
            Type[] messageTypes =
            {
                typeof(Message0),
                typeof(Message1),
                typeof(Message2),
                typeof(Message3),
                typeof(Message4),
                typeof(Message5),
                typeof(Message6),
                typeof(Message7),
                typeof(Message8),
                typeof(Message9),
                typeof(Message10),
                typeof(Message11),
                typeof(Message12),
                typeof(Message13),
                typeof(Message14),
                typeof(Message15),
                typeof(Message16),
                typeof(Message17),
                typeof(Message18),
                typeof(Message19),
                typeof(Message20),
                typeof(Message21),
                typeof(Message22)
            };

            Dictionary <Type, TaskCompletionSource <bool> > tasksCompleted = messageTypes.ToDictionary(k => k, v => new TaskCompletionSource <bool>());

            var busControl = Bus.Factory.CreateUsingAmazonSqs(cfg =>
            {
                BusTestFixture.ConfigureBusDiagnostics(cfg);

                cfg.Host(new Uri("amazonsqs://localhost:4566"), h =>
                {
                    h.AccessKey("admin");
                    h.SecretKey("admin");
                    h.Config(new AmazonSimpleNotificationServiceConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                    h.Config(new AmazonSQSConfig {
                        ServiceURL = "http://localhost:4566"
                    });
                });

                Func <object, Task> receiveTask = t =>
                {
                    tasksCompleted[t.GetType()].SetResult(true);
                    return(TaskUtil.Completed);
                };

                cfg.ReceiveEndpoint("long_multi_subs_queue", e =>
                {
                    e.Handler <Message0>(async c => await receiveTask(c.Message));
                    e.Handler <Message1>(async c => await receiveTask(c.Message));
                    e.Handler <Message2>(async c => await receiveTask(c.Message));
                    e.Handler <Message3>(async c => await receiveTask(c.Message));
                    e.Handler <Message4>(async c => await receiveTask(c.Message));
                    e.Handler <Message5>(async c => await receiveTask(c.Message));
                    e.Handler <Message6>(async c => await receiveTask(c.Message));
                    e.Handler <Message7>(async c => await receiveTask(c.Message));
                    e.Handler <Message8>(async c => await receiveTask(c.Message));
                    e.Handler <Message9>(async c => await receiveTask(c.Message));
                    e.Handler <Message10>(async c => await receiveTask(c.Message));
                    e.Handler <Message11>(async c => await receiveTask(c.Message));
                    e.Handler <Message12>(async c => await receiveTask(c.Message));
                    e.Handler <Message13>(async c => await receiveTask(c.Message));
                    e.Handler <Message14>(async c => await receiveTask(c.Message));
                    e.Handler <Message15>(async c => await receiveTask(c.Message));
                    e.Handler <Message16>(async c => await receiveTask(c.Message));
                    e.Handler <Message17>(async c => await receiveTask(c.Message));
                    e.Handler <Message18>(async c => await receiveTask(c.Message));
                    e.Handler <Message19>(async c => await receiveTask(c.Message));
                    e.Handler <Message20>(async c => await receiveTask(c.Message));
                    e.Handler <Message21>(async c => await receiveTask(c.Message));
                    e.Handler <Message22>(async c => await receiveTask(c.Message));
                });
            });

            await busControl.StartAsync();

            IEnumerable <Task> publishTasks = messageTypes.Select(m => busControl.Publish(Activator.CreateInstance(m)));
            await Task.WhenAll(publishTasks);

            IEnumerable <Task <bool> > awaitTasks = tasksCompleted.Values.Select(async t => await t.Task.OrTimeout(TimeSpan.FromSeconds(20)));
            await Task.WhenAll(awaitTasks);

            await busControl.StopAsync();
        }
Exemple #21
0
        public async Task Should_update_the_filter_expression()
        {
            var topicName        = "masstransit.azure.servicebus.core.tests.topologytesttypes/messagea";
            var subscriptionName = "input-message-a";

            var managementClient = Configuration.GetManagementClient();

            await managementClient.DeleteTopicAsync(topicName);

            ServiceBusTokenProviderSettings settings = new TestAzureServiceBusAccountSettings();

            var serviceUri = AzureServiceBusEndpointUriCreator.Create(Configuration.ServiceNamespace);

            var bus = Bus.Factory.CreateUsingAzureServiceBus(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);
                x.Host(serviceUri, h =>
                {
                    h.SharedAccessSignature(s =>
                    {
                        s.KeyName         = settings.KeyName;
                        s.SharedAccessKey = settings.SharedAccessKey;
                        s.TokenTimeToLive = settings.TokenTimeToLive;
                        s.TokenScope      = settings.TokenScope;
                    });
                });

                x.ReceiveEndpoint("subscription-input-queue", e =>
                {
                    e.Subscribe <MessageA>(subscriptionName, s => s.Filter = new SqlFilter("0 = 1"));
                });
            });

            var busHandle = await bus.StartAsync();

            await busHandle.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token);

            IList <RuleDescription> rules = await managementClient.GetRulesAsync(topicName, subscriptionName);

            Assert.That(rules.Count, Is.EqualTo(1));
            Assert.That(rules[0].Filter, Is.InstanceOf <SqlFilter>());

            var filter = rules[0].Filter as SqlFilter;

            Assert.That(filter.SqlExpression, Is.EqualTo("0 = 1"));

            bus = Bus.Factory.CreateUsingAzureServiceBus(x =>
            {
                BusTestFixture.ConfigureBusDiagnostics(x);
                x.Host(serviceUri, h =>
                {
                    h.SharedAccessSignature(s =>
                    {
                        s.KeyName         = settings.KeyName;
                        s.SharedAccessKey = settings.SharedAccessKey;
                        s.TokenTimeToLive = settings.TokenTimeToLive;
                        s.TokenScope      = settings.TokenScope;
                    });
                });

                x.ReceiveEndpoint("subscription-input-queue", e =>
                {
                    e.Subscribe <MessageA>(subscriptionName, s => s.Filter = new SqlFilter("1 = 1"));
                });
            });

            busHandle = await bus.StartAsync();

            await busHandle.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token);

            rules = await managementClient.GetRulesAsync(topicName, subscriptionName);

            Assert.That(rules.Count, Is.EqualTo(1));
            Assert.That(rules[0].Filter, Is.InstanceOf <SqlFilter>());

            filter = rules[0].Filter as SqlFilter;
            Assert.That(filter.SqlExpression, Is.EqualTo("1 = 1"));
        }