public void RabbitMqService_PublishMessage_When_Null_Throws_Exception() { string message = string.Empty; var rabbitMqService = new RabbitMqService(_rabbitMqOptionsMock.Object); rabbitMqService.PublishMessage(message); }
public void RabbitMqService_PublishMessage_When_Have_Valid_Message_Sends_To_RabbitMq() { _rabbitMqOptionsMock.Object.HostName = "localhost"; _rabbitMqOptionsMock.Object.NameMessageExchangeName = "AppName.Service.NameMessageExchange"; _rabbitMqOptionsMock.Object.NameMessageQueueName = "AppName.Service.NameMessageQueue"; _rabbitMqOptionsMock.Object.JsonMimeType = "application/json"; var objNameMessage = new NameMessage { Message = "Name" }; var serializedMessage = JsonConvert.SerializeObject(objNameMessage); var rabbitMqService = new RabbitMqService(_rabbitMqOptionsMock.Object); rabbitMqService.CreateConnection(); rabbitMqService.PublishMessage(serializedMessage); }