2006-02-24 13:39:16 -05:00
|
|
|
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);
|
2006-02-27 06:28:35 -05:00
|
|
|
Console.WriteLine("Created consumer: " + consumer);
|
|
|
|
|
2006-02-24 13:39:16 -05:00
|
|
|
Assert.Fail("Should have thrown an exception!");
|
|
|
|
}
|
|
|
|
catch (BrokerException e)
|
|
|
|
{
|
|
|
|
Console.WriteLine("Caught expected exception: " + e);
|
|
|
|
Console.WriteLine("Stack: " + e.StackTrace);
|
2006-02-27 06:28:35 -05:00
|
|
|
Console.WriteLine("Java Stack: " + e.JavaStackTrace);
|
2006-02-24 13:39:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|