public void Ensure_log_messages_are_redirected()
    {
        LogMessageCapture.CaptureLogMessages();
        LogManager.Use <NLogFactory>();

        var busConfig = new BusConfiguration();

        busConfig.EndpointName("NLogTests");
        busConfig.UseSerialization <JsonSerializer>();
        busConfig.EnableInstallers();
        busConfig.UsePersistence <InMemoryPersistence>();

        using (var bus = Bus.Create(busConfig))
        {
            bus.Start();
            Assert.IsNotEmpty(LogMessageCapture.Messages);
        }
    }
Exemple #2
0
    public async Task Ensure_log_messages_are_redirected()
    {
        LogMessageCapture.CaptureLogMessages();
        LogManager.Use <NLogFactory>();

        var endpointConfiguration = new EndpointConfiguration("NLogTests");

        endpointConfiguration.UseSerialization <JsonSerializer>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.UsePersistence <InMemoryPersistence>();

        var endpoint = await Endpoint.Start(endpointConfiguration);

        try
        {
            Assert.IsNotEmpty(LogMessageCapture.LoggingEvents);
        }
        finally
        {
            await endpoint.Stop();
        }
    }