public void TearDown() { if (_testAdapter != null) { _testAdapter.Shutdown(RabbitMqAdapter.DefaultOperationTimeout); } _tester.Shutdown(); }
public void SendHeader() { var o = new GlobalOptionsFactory().Load(); var consumerOptions = new ConsumerOptions(); consumerOptions.QueueName = "TEST.HeaderPreservationTest_Read1"; consumerOptions.AutoAck = false; consumerOptions.QoSPrefetchCount = 1; TestConsumer consumer; using (var tester = new MicroserviceTester(o.RabbitOptions, consumerOptions)) { var header = new MessageHeader(); header.MessageGuid = Guid.Parse("5afce68f-c270-4bf3-b327-756f6038bb76"); header.Parents = new[] { Guid.Parse("12345678-c270-4bf3-b327-756f6038bb76"), Guid.Parse("87654321-c270-4bf3-b327-756f6038bb76") }; tester.SendMessage(consumerOptions, header, new TestMessage() { Message = "hi" }); consumer = new TestConsumer(); var a = new RabbitMqAdapter(o.RabbitOptions.CreateConnectionFactory(), "TestHost"); a.StartConsumer(consumerOptions, consumer); TestTimelineAwaiter awaiter = new TestTimelineAwaiter(); awaiter.Await(() => consumer.Failed || consumer.Passed, "timed out", 5000); a.Shutdown(RabbitMqAdapter.DefaultOperationTimeout); } Assert.IsTrue(consumer.Passed); }
/// <summary> /// Shuts down the tester without performing cleanup of any declared queues / exchanges /// </summary> public void Shutdown() { foreach (MicroserviceHost host in StopOnDispose) { host.Stop("MicroserviceTester Disposed"); } _adapter.Shutdown(RabbitMqAdapter.DefaultOperationTimeout); }
public void Dispose() { if (DeleteRabbitBitsOnDispose) { TestModel.QueueDelete(RejectQueueName); TestModel.ExchangeDelete(RejectExchangeName); } TestModel.Close(); _testConnection.Close(); _testAdapter.Shutdown(RabbitMqAdapter.DefaultOperationTimeout); }