activemq/openwire-dotnet/tests/OpenWire.Client/BadConsumeTest.cs

34 lines
1.1 KiB
C#
Raw Normal View History

using NUnit.Framework;
using System;
namespace OpenWire.Client
{
[TestFixture]
public class BadConsumeTest : TestSupport
{
[Test]
public void TestBadConsumeOperationToTestExceptions()
{
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
using (IConnection connection = factory.CreateConnection())
{
ISession session = connection.CreateSession();
try
{
IMessageConsumer consumer = session.CreateConsumer(null);
Console.WriteLine("Created consumer: " + consumer);
Assert.Fail("Should have thrown an exception!");
}
catch (BrokerException e)
{
Console.WriteLine("Caught expected exception: " + e);
Console.WriteLine("Stack: " + e.StackTrace);
Console.WriteLine("Java Stack: " + e.JavaStackTrace);
}
}
}
}
}