public void MessageBus_SendMessage_Success() { string test_queue = $"test-queue-{Guid.NewGuid().ToString().ToLower().Replace("{", "").Replace("}", "")}"; IConfiguration config = GetConfiguration(); var cfg = config.GetSection("MsgBusConfig").Get <MsgBusConfig>(); IMessageBus msgBus = new Fineo.MessageBus.Azure.MessageBus(); IMessageBusParams msgBusParams = msgBus.CreateInitParams(); msgBusParams.Parameters["MessageQueue"] = test_queue; msgBusParams.Parameters["StorageAccountKey"] = cfg.StorageAccountKey; msgBusParams.Parameters["StorageAccountName"] = cfg.StorageAccountName; msgBusParams.Parameters["QueueEndpoint"] = cfg.QueueEndpoint; msgBus.Init(msgBusParams); var section = config.GetSection("TestMessage"); MessageBusDto busDto = config.GetSection("TestMessage").Get <MessageBusDto>(); busDto.Body = Guid.NewGuid().ToString(); msgBus.Send(busDto); MessageBusDto receivedDto = msgBus.ReadNext(); Assert.IsTrue(busDto.Equals(receivedDto)); msgBus.Delete(); }
public void InitMessageBus_Success() { IConfiguration config = GetConfiguration(); var cfg = config.GetSection("MsgBusConfig").Get <MsgBusConfig>(); IMessageBus msgBus = new Fineo.MessageBus.Azure.MessageBus(); IMessageBusParams msgBusParams = msgBus.CreateInitParams(); msgBusParams.Parameters["MessageQueue"] = cfg.MessageQueue; msgBusParams.Parameters["StorageAccountKey"] = cfg.StorageAccountKey; msgBusParams.Parameters["StorageAccountName"] = cfg.StorageAccountName; msgBusParams.Parameters["QueueEndpoint"] = cfg.QueueEndpoint; msgBus.Init(msgBusParams); msgBus.Delete(); }