Ejemplo n.º 1
0
        async Task Plugin_without_ShouldContinueOnException_should_throw()
        {
            var messageSender = new MessageSender(TestUtility.NamespaceConnectionString, TestConstants.NonPartitionedQueueName);

            try
            {
                var plugin = new ExceptionPlugin();

                messageSender.RegisterPlugin(plugin);

                var sendMessage = new Message(Encoding.UTF8.GetBytes("Test message"));
                await Assert.ThrowsAsync <NotImplementedException>(() => messageSender.SendAsync(sendMessage));
            }
            finally
            {
                await messageSender.CloseAsync();
            }
        }
Ejemplo n.º 2
0
        async Task Plugin_without_ShouldContinueOnException_should_throw()
        {
            await ServiceBusScope.UsingQueueAsync(partitioned : false, sessionEnabled : false, async queueName =>
            {
                var messageSender = new MessageSender(TestUtility.NamespaceConnectionString, queueName);
                try
                {
                    var plugin = new ExceptionPlugin();

                    messageSender.RegisterPlugin(plugin);

                    var sendMessage = new Message(Encoding.UTF8.GetBytes("Test message"));
                    await Assert.ThrowsAsync <NotImplementedException>(() => messageSender.SendAsync(sendMessage));
                }
                finally
                {
                    await messageSender.CloseAsync();
                }
            });
        }