diff --git a/example/Sample/Sample.csproj b/example/Sample/Sample.csproj index ec04f95..e307db1 100644 --- a/example/Sample/Sample.csproj +++ b/example/Sample/Sample.csproj @@ -17,8 +17,5 @@ - - - diff --git a/serilog-sinks-file.sln.DotSettings b/serilog-sinks-file.sln.DotSettings index bfd92fd..95887cc 100644 --- a/serilog-sinks-file.sln.DotSettings +++ b/serilog-sinks-file.sln.DotSettings @@ -1,2 +1,3 @@  + True True \ No newline at end of file diff --git a/src/Serilog.Sinks.File/Serilog.Sinks.File.csproj b/src/Serilog.Sinks.File/Serilog.Sinks.File.csproj index 14bdff7..f498bf6 100644 --- a/src/Serilog.Sinks.File/Serilog.Sinks.File.csproj +++ b/src/Serilog.Sinks.File/Serilog.Sinks.File.csproj @@ -4,7 +4,7 @@ Write Serilog events to text files in plain or JSON format. 5.0.0 Serilog Contributors - net45;netstandard1.3;netstandard2.0 + net45;netstandard1.3;netstandard2.0;netcoreapp3.0 true ../../assets/Serilog.snk true @@ -18,7 +18,7 @@ false Serilog true - true + true false true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb @@ -26,13 +26,7 @@ - - - - - - - + @@ -43,23 +37,23 @@ $(DefineConstants);OS_MUTEX - + $(DefineConstants);OS_MUTEX - - - - - - - + + + + + + + - - - + + + diff --git a/test/Serilog.Sinks.File.Tests/FileSinkTests.cs b/test/Serilog.Sinks.File.Tests/FileSinkTests.cs index 2d0f210..10fe926 100644 --- a/test/Serilog.Sinks.File.Tests/FileSinkTests.cs +++ b/test/Serilog.Sinks.File.Tests/FileSinkTests.cs @@ -130,7 +130,7 @@ public void WhenLimitIsSpecifiedAndEncodingHasNoPreambleDataIsCorrectlyAppendedT long? maxBytes = 5000; var encoding = new UTF8Encoding(false); - Assert.Equal(0, encoding.GetPreamble().Length); + Assert.Empty(encoding.GetPreamble()); WriteTwoEventsAndCheckOutputFileLength(maxBytes, encoding); } @@ -139,7 +139,7 @@ public void WhenLimitIsNotSpecifiedAndEncodingHasNoPreambleDataIsCorrectlyAppend { var encoding = new UTF8Encoding(false); - Assert.Equal(0, encoding.GetPreamble().Length); + Assert.Empty(encoding.GetPreamble()); WriteTwoEventsAndCheckOutputFileLength(null, encoding); } diff --git a/test/Serilog.Sinks.File.Tests/RollingFileSinkTests.cs b/test/Serilog.Sinks.File.Tests/RollingFileSinkTests.cs index 568f7a7..d295dfc 100644 --- a/test/Serilog.Sinks.File.Tests/RollingFileSinkTests.cs +++ b/test/Serilog.Sinks.File.Tests/RollingFileSinkTests.cs @@ -227,8 +227,8 @@ public void WhenStreamWrapperSpecifiedIsUsedForRolledFiles() textStream.Position = 0; var lines = textStream.ReadAllLines(); - Assert.Equal(1, lines.Count); - Assert.True(lines[0].EndsWith(logEvents[i].MessageTemplate.Text)); + Assert.Single(lines); + Assert.EndsWith(logEvents[i].MessageTemplate.Text, lines[0]); } } } diff --git a/test/Serilog.Sinks.File.Tests/Serilog.Sinks.File.Tests.csproj b/test/Serilog.Sinks.File.Tests/Serilog.Sinks.File.Tests.csproj index 3491e32..fcf2880 100644 --- a/test/Serilog.Sinks.File.Tests/Serilog.Sinks.File.Tests.csproj +++ b/test/Serilog.Sinks.File.Tests/Serilog.Sinks.File.Tests.csproj @@ -1,13 +1,12 @@ - net452;netcoreapp1.0;netcoreapp2.0 + net47;netcoreapp3.1 true Serilog.Sinks.File.Tests ../../assets/Serilog.snk true true - Serilog.Sinks.RollingFile.Tests true $(PackageTargetFallback);dnxcore50;portable-net45+win8 1.0.4 @@ -18,9 +17,9 @@ - - - + + + @@ -32,5 +31,4 @@ - diff --git a/test/Serilog.Sinks.File.Tests/Support/Some.cs b/test/Serilog.Sinks.File.Tests/Support/Some.cs index 2d29d4d..f0c7fd9 100644 --- a/test/Serilog.Sinks.File.Tests/Support/Some.cs +++ b/test/Serilog.Sinks.File.Tests/Support/Some.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; @@ -7,6 +6,8 @@ using Serilog.Parsing; using Xunit.Sdk; +// ReSharper disable UnusedMember.Global + namespace Serilog.Sinks.File.Tests.Support { static class Some @@ -46,10 +47,8 @@ public static DateTimeOffset OffsetInstant() public static LogEvent LogEvent(string messageTemplate, params object[] propertyValues) { var log = new LoggerConfiguration().CreateLogger(); - MessageTemplate template; - IEnumerable properties; #pragma warning disable Serilog004 // Constant MessageTemplate verifier - if (!log.BindMessageTemplate(messageTemplate, propertyValues, out template, out properties)) + if (!log.BindMessageTemplate(messageTemplate, propertyValues, out var template, out var properties)) #pragma warning restore Serilog004 // Constant MessageTemplate verifier { throw new XunitException("Template could not be bound."); @@ -65,7 +64,7 @@ public static LogEvent LogEvent(DateTimeOffset? timestamp = null, LogEventLevel public static LogEvent InformationEvent(DateTimeOffset? timestamp = null) { - return LogEvent(timestamp, LogEventLevel.Information); + return LogEvent(timestamp); } public static LogEvent DebugEvent(DateTimeOffset? timestamp = null) diff --git a/test/Serilog.Sinks.File.Tests/TemplatedPathRollerTests.cs b/test/Serilog.Sinks.File.Tests/TemplatedPathRollerTests.cs index 5e1b015..65a974c 100644 --- a/test/Serilog.Sinks.File.Tests/TemplatedPathRollerTests.cs +++ b/test/Serilog.Sinks.File.Tests/TemplatedPathRollerTests.cs @@ -12,8 +12,7 @@ public void TheLogFileIncludesDateToken() { var roller = new PathRoller(Path.Combine("Logs", "log-.txt"), RollingInterval.Day); var now = new DateTime(2013, 7, 14, 3, 24, 9, 980); - string path; - roller.GetLogFilePath(now, null, out path); + roller.GetLogFilePath(now, null, out var path); AssertEqualAbsolute(Path.Combine("Logs", "log-20130714.txt"), path); } @@ -22,8 +21,7 @@ public void ANonZeroIncrementIsIncludedAndPadded() { var roller = new PathRoller(Path.Combine("Logs", "log-.txt"), RollingInterval.Day); var now = new DateTime(2013, 7, 14, 3, 24, 9, 980); - string path; - roller.GetLogFilePath(now, 12, out path); + roller.GetLogFilePath(now, 12, out var path); AssertEqualAbsolute(Path.Combine("Logs", "log-20130714_012.txt"), path); } @@ -46,8 +44,7 @@ public void TheLogFileIsNotRequiredToIncludeAnExtension() { var roller = new PathRoller(Path.Combine("Logs", "log-"), RollingInterval.Day); var now = new DateTime(2013, 7, 14, 3, 24, 9, 980); - string path; - roller.GetLogFilePath(now, null, out path); + roller.GetLogFilePath(now, null, out var path); AssertEqualAbsolute(Path.Combine("Logs", "log-20130714"), path); } @@ -56,19 +53,18 @@ public void TheLogFileIsNotRequiredToIncludeADirectory() { var roller = new PathRoller("log-", RollingInterval.Day); var now = new DateTime(2013, 7, 14, 3, 24, 9, 980); - string path; - roller.GetLogFilePath(now, null, out path); + roller.GetLogFilePath(now, null, out var path); AssertEqualAbsolute("log-20130714", path); } [Fact] - public void MatchingExcludesSimilarButNonmatchingFiles() + public void MatchingExcludesSimilarButNonMatchingFiles() { var roller = new PathRoller("log-.txt", RollingInterval.Day); const string similar1 = "log-0.txt"; - const string similar2 = "log-helloyou.txt"; + const string similar2 = "log-hello.txt"; var matched = roller.SelectMatches(new[] { similar1, similar2 }); - Assert.Equal(0, matched.Count()); + Assert.Empty(matched); } [Fact] @@ -86,7 +82,7 @@ public void MatchingSelectsFiles(string template, string zeroth, string thirtyFi var roller = new PathRoller(template, interval); var matched = roller.SelectMatches(new[] { zeroth, thirtyFirst }).ToArray(); Assert.Equal(2, matched.Length); - Assert.Equal(null, matched[0].SequenceNumber); + Assert.Null(matched[0].SequenceNumber); Assert.Equal(31, matched[1].SequenceNumber); }