Skip to content

Commit 993a91e

Browse files
authored
Merge pull request serilog-mssql#139 from MV10/xunit_updates
[chore] update all test dependencies to latest stable release versions
2 parents 12a5e83 + a248f74 commit 993a91e

File tree

2 files changed

+78
-10
lines changed

2 files changed

+78
-10
lines changed

test/Serilog.Sinks.MSSqlServer.Tests/Serilog.Sinks.MSSqlServer.Tests.csproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
<!--
44
Because this is a multi-targeted project/solution, run tests from the command line
5-
with the current working directory set to the location of this csproj. Tests will not
6-
execute within the VS IDE as of version 15.6.5 (April 2018).
5+
with the current working directory set to the location of this csproj. As of Sept 2018
6+
the VS2017 IDE (v15.8.3) will only run a .NET Core test, there is no way to run
7+
the .NET Framework test from the IDE.
78
89
dotnet test [dash dash]framework net452
910
dotnet test [dash dash]framework netcoreapp2.0
@@ -25,10 +26,11 @@
2526

2627
<ItemGroup>
2728
<ProjectReference Include="..\..\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" />
28-
<PackageReference Include="FluentAssertions" Version="4.19.4" />
29-
<PackageReference Include="Dapper.StrongName" Version="1.50.2" />
29+
<PackageReference Include="FluentAssertions" Version="5.4.1" />
30+
<PackageReference Include="Dapper.StrongName" Version="1.50.5" />
3031
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0" />
31-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20171012-09" />
32+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
33+
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
3234
</ItemGroup>
3335

3436
<ItemGroup>
@@ -42,8 +44,8 @@
4244
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
4345
<Reference Include="System" />
4446
<Reference Include="Microsoft.CSharp" />
45-
<PackageReference Include="xunit" Version="2.3.0" />
46-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" NoWarn="NU1701" />
47+
<PackageReference Include="xunit" Version="2.4.0" />
48+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
4749
<Compile Include="Configuration\NetFramework.ConfigurationManager\**\*.cs" />
4850
</ItemGroup>
4951

@@ -54,9 +56,9 @@
5456
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
5557
<PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />
5658
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
57-
<PackageReference Include="xunit" Version="2.3.0" />
58-
<PackageReference Include="xunit.core" Version="2.3.0" />
59-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" NoWarn="NU1701">
59+
<PackageReference Include="xunit" Version="2.4.0" />
60+
<PackageReference Include="xunit.core" Version="2.4.0" />
61+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
6062
<PrivateAssets>all</PrivateAssets>
6163
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
6264
</PackageReference>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using System.Data.SqlClient;
5+
using Dapper;
6+
using FluentAssertions;
7+
using Xunit;
8+
9+
namespace Serilog.Sinks.MSSqlServer.Tests
10+
{
11+
[Collection("LogTest")]
12+
public class TestMiscFeatures
13+
{
14+
internal class LogEventColumns
15+
{
16+
public string LogEvent { get; set; }
17+
}
18+
19+
[Fact]
20+
public void LogEventExcludeAdditionalProperties()
21+
{
22+
// arrange
23+
const string tableName = "LogEventExcludeProps";
24+
var columnOptions = new ColumnOptions()
25+
{
26+
AdditionalDataColumns = new List<DataColumn>
27+
{
28+
new DataColumn { DataType = typeof(string), ColumnName = "B" }
29+
}
30+
};
31+
columnOptions.Store.Remove(StandardColumn.Properties);
32+
columnOptions.Store.Add(StandardColumn.LogEvent);
33+
columnOptions.LogEvent.ExcludeAdditionalProperties = true;
34+
35+
Log.Logger = new LoggerConfiguration()
36+
.WriteTo.MSSqlServer
37+
(
38+
connectionString: DatabaseFixture.LogEventsConnectionString,
39+
tableName: tableName,
40+
columnOptions: columnOptions,
41+
autoCreateSqlTable: true,
42+
batchPostingLimit: 1,
43+
period: TimeSpan.FromSeconds(10)
44+
)
45+
.CreateLogger();
46+
47+
// act
48+
Log.Logger
49+
.ForContext("A", "AValue")
50+
.ForContext("B", "BValue")
51+
.Information("Logging message");
52+
53+
Log.CloseAndFlush();
54+
55+
// assert
56+
using (var conn = new SqlConnection(DatabaseFixture.LogEventsConnectionString))
57+
{
58+
var logEvents = conn.Query<LogEventColumns>($"SELECT LogEvent from {tableName}");
59+
60+
logEvents.Should().Contain(e => e.LogEvent.Contains("AValue"));
61+
logEvents.Should().NotContain(e => e.LogEvent.Contains("BValue"));
62+
}
63+
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)