Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Getting tests running for standard2.0 and 2.1, and some general c… (#16)
Browse files Browse the repository at this point in the history
Getting tests running for standard2.0 and 2.1, and some general cleanup.
  • Loading branch information
ejcoyle88 authored Nov 5, 2019
2 parents 0d440fc + 48b5ffe commit 796e37d
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 269 deletions.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '{build}'
image: Visual Studio 2017
image: Visual Studio 2019
configuration: Release
pull_requests:
do_not_increment_build_number: true
Expand All @@ -17,7 +17,7 @@ environment:
#- packages -> **\packages.config

install:
- ps: choco install gitversion.portable -y -r --no-progress
- ps: choco install gitversion.portable -y -r --no-progress --version=4.0.0
- ps: dotnet tool install --global coverlet.console

assembly_info:
Expand Down
1 change: 1 addition & 0 deletions src/CoverageReports/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.opencover.xml
241 changes: 0 additions & 241 deletions src/CoverageResults/coverage.opencover.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using FakeItEasy;
using Microsoft.AspNetCore.Http;
using FakeItEasy;
using NUnit.Framework;
using Serilog.Enrichers;
using Serilog.Events;
using Serilog.Tests.Support;
using Microsoft.AspNetCore.Http;

namespace Serilog.Tests.Enrichers
{
Expand All @@ -20,7 +20,7 @@ public void SetUp()

private IHttpContextAccessor _httpContextAccessor;
private CorrelationIdEnricher _enricher;

[Test]
public void When_CurrentHttpContextIsNotNull_Should_CreateCorrelationIdProperty()
{
Expand All @@ -45,7 +45,7 @@ public void When_CurrentHttpContextIsNotNull_ShouldNot_CreateCorrelationIdProper
{
A.CallTo(() => _httpContextAccessor.HttpContext)
.Returns(null);

LogEvent evt = null;
var log = new LoggerConfiguration()
.Enrich.With(_enricher)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using FakeItEasy;
using Microsoft.AspNetCore.Http;
using FakeItEasy;
using NUnit.Framework;
using Serilog.Enrichers;
using Serilog.Events;
using Serilog.Tests.Support;
using Microsoft.AspNetCore.Http;

namespace Serilog.Tests.Enrichers
{
Expand All @@ -12,7 +12,7 @@ namespace Serilog.Tests.Enrichers
public class CorrelationIdHeaderEnricherTests
{
private const string HeaderKey = "x-correlation-id";

[SetUp]
public void SetUp()
{
Expand All @@ -28,7 +28,7 @@ public void When_CorrelationIdNotInHeader_Should_CreateCorrelationIdProperty()
{
A.CallTo(() => _httpContextAccessor.HttpContext)
.Returns(new DefaultHttpContext());

LogEvent evt = null;
var log = new LoggerConfiguration()
.Enrich.With(_enricher)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<RootNamespace>Serilog.Tests</RootNamespace>
</PropertyGroup>

</PropertyGroup>
<ItemGroup>
<PackageReference Include="FakeItEasy" Version="4.9.2" />
<PackageReference Include="FakeItEasy" Version="5.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.12.0" />
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="coverlet.msbuild" Version="2.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Serilog.Enrichers.CorrelationId\Serilog.Enrichers.CorrelationId.csproj" />
</ItemGroup>

</Project>
7 changes: 5 additions & 2 deletions src/Serilog.Enrichers.CorrelationId.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,23 @@
<releaseNotes></releaseNotes>
<copyright></copyright>
<tags>serilog enrichers enricher correlationid correlation id</tags>

<dependencies>
<group targetFramework="net45">
<dependency id="Serilog" version="2.4.0" />
</group>

<group targetFramework="netstandard2.0">
<dependency id="Microsoft.AspNetCore.Http" version="2.1.1" />
<dependency id="Serilog" version="2.7.1" />
</group>
<group targetFramework="netstandard2.1">
<dependency id="Microsoft.AspNetCore.Http" version="2.2.2" />
<dependency id="Serilog" version="2.9.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="Serilog.Enrichers.CorrelationId\bin\$target$\net45\*.dll" target="lib/net45" />
<file src="Serilog.Enrichers.CorrelationId\bin\$target$\netstandard2.0\*.dll" target="lib/netstandard2.0" />
<file src="Serilog.Enrichers.CorrelationId\bin\$target$\netstandard2.1\*.dll" target="lib/netstandard2.1" />
</files>
</package>
7 changes: 7 additions & 0 deletions src/Serilog.Enrichers.CorrelationId.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Enrichers.Correlati
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Enrichers.CorrelationId.Tests", "Serilog.Enrichers.CorrelationId.Tests\Serilog.Enrichers.CorrelationId.Tests.csproj", "{1979E570-3BB8-4DF4-B056-664A924442F8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ci_config", "ci_config", "{4012140B-49D7-48A8-A264-97AE936099CD}"
ProjectSection(SolutionItems) = preProject
..\appveyor.yml = ..\appveyor.yml
..\GitVersion.yml = ..\GitVersion.yml
Serilog.Enrichers.CorrelationId.nuspec = Serilog.Enrichers.CorrelationId.nuspec
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CorrelationIdHeaderEnricher : ILogEventEnricher
public CorrelationIdHeaderEnricher(string headerKey) : this(headerKey, new HttpContextAccessor())
{
}

internal CorrelationIdHeaderEnricher(string headerKey, IHttpContextAccessor contextAccessor)
{
_headerKey = headerKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@
<PropertyGroup>
<AssemblyName>Serilog.Enrichers.CorrelationId</AssemblyName>
<RootNamespace>Serilog</RootNamespace>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>7.3</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1'">
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45'">
<DefineConstants>NET45;NETFULL</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.7.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.1" />
<PackageReference Include="Serilog" Version="2.7.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Serilog" Version="2.9.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45'">
<Reference Include="System.Web" />
<PackageReference Include="Serilog" Version="2.7.1" />
</ItemGroup>

</Project>

0 comments on commit 796e37d

Please sign in to comment.