Skip to content

Commit

Permalink
Updated test and test project
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasArdal committed Jun 19, 2023
1 parent 30a3f52 commit c3a439e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
43 changes: 22 additions & 21 deletions test/Serilog.Sinks.ElmahIo.Tests/Serilog.Sinks.ElmahIo.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<AssemblyName>Serilog.Sinks.ElmahIo.Tests</AssemblyName>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<AssemblyName>Serilog.Sinks.ElmahIo.Tests</AssemblyName>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Sinks.ElmahIo\Serilog.Sinks.ElmahIo.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Sinks.ElmahIo\Serilog.Sinks.ElmahIo.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);DOTNETCORE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);DOTNETCORE</DefineConstants>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ public async Task CanEmit()
Assert.That(loggedMessage.DateTime.Value.DateTime, Is.EqualTo(Now.DateTime.ToUniversalTime()));
Assert.That(loggedMessage.Detail, Is.EqualTo(exception.ToString()));
Assert.That(loggedMessage.Data != null);
Assert.That(loggedMessage.Data.Count, Is.EqualTo(2));
Assert.That(loggedMessage.Data.Any(d => d.Key == "name"));
#if DOTNETCORE
Assert.That(loggedMessage.Data.Any(d => d.Key == "X-ELMAHIO-FRAMEWORKDESCRIPTION"));
#endif
Assert.That(loggedMessage.Data.Any(d => d.Key == "X-ELMAHIO-EXCEPTIONINSPECTOR"));
Assert.That(loggedMessage.Type, Is.EqualTo(typeof(DivideByZeroException).FullName));
Assert.That(loggedMessage.Hostname, Is.EqualTo(Environment.MachineName));
Expand Down

0 comments on commit c3a439e

Please sign in to comment.