public void TestRecoveryWithTopologyDisabled() { AutorecoveringConnection conn = CreateAutorecoveringConnectionWithTopologyRecoveryDisabled(); IModel ch = conn.CreateModel(); string s = "dotnet-client.test.recovery.q2"; ch.QueueDelete(s); ch.QueueDeclare(s, false, true, false, null); ch.QueueDeclarePassive(s); Assert.IsTrue(ch.IsOpen); try { CloseAndWaitForRecovery(conn); Assert.IsTrue(ch.IsOpen); ch.QueueDeclarePassive(s); Assert.Fail("Expected an exception"); } catch (OperationInterruptedException e) { // expected } finally { conn.Abort(); } }
public void TestCreateModelOnClosedAutorecoveringConnectionDoesNotHang() { // we don't want this to recover quickly in this test AutorecoveringConnection c = CreateAutorecoveringConnection(TimeSpan.FromSeconds(20)); try { c.Close(); WaitForShutdown(c); Assert.IsFalse(c.IsOpen); c.CreateModel(); Assert.Fail("Expected an exception"); } catch (AlreadyClosedException) { // expected } finally { StartRabbitMQ(); if (c.IsOpen) { c.Abort(); } } }