/// <summary> /// Constructor /// </summary> /// <param name="core">A reference to the core messaging system</param> /// <exception cref="ArgumentNullException"></exception> internal ServiceBusCore(MessagingCore core) { if (core == null) { throw new ArgumentNullException(nameof(core)); } Core = core; var connectionString = core.Settings.ServiceBus.ConnectionString; if (connectionString == null) { throw new ArgumentNullException("connectionString"); } if (connectionString.StartsWith("http://") || connectionString.StartsWith("https://")) { FactoryPool = new HttpServiceBusFactoryPool(core.Settings.ServiceBus); } else { FactoryPool = new ServiceBusFactoryPool(core.Settings.ServiceBus); } SenderPool = new ServiceBusSenderPool(core.Settings.ServiceBus, FactoryPool); ReceiverPool = new ServiceBusReceiverPool(core.Settings.ServiceBus, FactoryPool); }
public void WhenHandlerForMessageNotFound_ThenThrowException() { // Arrange var messagingCore = new MessagingCore(handlerProvider, handlerScanner); // Act, Assert Assert.ThrowsAsync <MessagingInfrastructureException>(() => messagingCore.Send(new TestMessageThird())); }
public async Task ShouldHandleMessage() { // Arrange var messagingCore = new MessagingCore(handlerProvider, handlerScanner); // Act var result = await messagingCore.Send(new TestMessageFirst()); // Assert Assert.AreEqual(200, result.Code); }