<commit_before>﻿using System;
using System.Reactive.Linq;
using System.Threading.Tasks;
using global::Owin;
using Microsoft.Owin.Testing;
using NUnit.Framework;
using Serilog.Events;

namespace Serilog.Extras.MSOwin
{
    public class SerilogMiddlewareTests
    {
        [TestFixture]
        public class WhenUsingARequestContext
        {
            LogEvent _eventSeen = null;
            private readonly TestServer _server;

            public WhenUsingARequestContext()
            {
                ILogger logger = new LoggerConfiguration()
                    .WriteTo
                    .Observers(events => events
                        .Do(evt => { _eventSeen = evt; })
                        .Subscribe())
                    .Enrich
                    .FromLogContext()
                    .CreateLogger();
                Log.Logger = logger;

                _server = TestServer.Create(
                    app => app.UseSerilogRequestContext()
                        .Use((context, func) =>
                        {
                            Log.Information("message");
                            return Task.Delay(0);
                        }));
            }

            [Test]
            public async Task Should_have_request_id_in_logevent_properties()
            {
                await MakeRequest();

                Assert.True(_eventSeen.Properties.ContainsKey(RequestContextMiddleware.RequestIdPropertyName));
            }

            [Test]
            public async Task Request_id_should_be_a_guid()
            {
                await MakeRequest();

                Guid _;
                Assert.True(Guid.TryParse(_eventSeen.Properties[RequestContextMiddleware.RequestIdPropertyName].ToString(), out _));
            }

            private async Task MakeRequest()
            {
                await _server.CreateRequest("/").GetAsync();
            }
        }
    }
}<commit_msg>Serilog.Extras.MSOwin: compile fix (field name)<commit_after>﻿using System;
using System.Reactive.Linq;
using System.Threading.Tasks;
using global::Owin;
using Microsoft.Owin.Testing;
using NUnit.Framework;
using Serilog.Events;

namespace Serilog.Extras.MSOwin
{
    public class SerilogMiddlewareTests
    {
        [TestFixture]
        public class WhenUsingARequestContext
        {
            LogEvent _eventSeen = null;
            private readonly TestServer _server;

            public WhenUsingARequestContext()
            {
                ILogger logger = new LoggerConfiguration()
                    .WriteTo
                    .Observers(events => events
                        .Do(evt => { _eventSeen = evt; })
                        .Subscribe())
                    .Enrich
                    .FromLogContext()
                    .CreateLogger();
                Log.Logger = logger;

                _server = TestServer.Create(
                    app => app.UseSerilogRequestContext()
                        .Use((context, func) =>
                        {
                            Log.Information("message");
                            return Task.Delay(0);
                        }));
            }

            [Test]
            public async Task Should_have_request_id_in_logevent_properties()
            {
                await MakeRequest();

                Assert.True(_eventSeen.Properties.ContainsKey(RequestContextMiddleware.DefaultRequestIdPropertyName));
            }

            [Test]
            public async Task Request_id_should_be_a_guid()
            {
                await MakeRequest();

                Guid _;
                Assert.True(Guid.TryParse(_eventSeen.Properties[RequestContextMiddleware.DefaultRequestIdPropertyName].ToString(), out _));
            }

            private async Task MakeRequest()
            {
                await _server.CreateRequest("/").GetAsync();
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.08146067415730338, 'fraction_numerical': 0.0005107252298263534, 'mean_word_length': 1.355381840048106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7593051', 'n_tokens_mistral': 953, 'n_tokens_neox': 915, 'n_words': 166}