Skip to content

Commit c2375eb

Browse files
committed
Fix test; update to use the 2019 build image
1 parent 00e3e94 commit c2375eb

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

appveyor.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
version: '{build}'
22
skip_tags: true
33
image:
4-
- Visual Studio 2017
5-
- Ubuntu
6-
configuration: Release
4+
- Visual Studio 2019
5+
- Ubuntu1804
76
build_script:
87
- ps: ./Build.ps1
98
for:
109
-
1110
matrix:
1211
only:
13-
- image: Ubuntu
12+
- image: Ubuntu1804
1413
build_script:
1514
- sh build.sh
1615
test: off

serilog-sinks-file.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Serilog/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

src/Serilog.Sinks.File/Serilog.Sinks.File.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
<Authors>Serilog Contributors</Authors>
77
<TargetFrameworks>net45;netstandard1.3;netstandard2.0</TargetFrameworks>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9-
<AssemblyName>Serilog.Sinks.File</AssemblyName>
109
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
1110
<SignAssembly>true</SignAssembly>
1211
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
13-
<PackageId>Serilog.Sinks.File</PackageId>
1412
<PackageTags>serilog;file</PackageTags>
1513
<PackageIconUrl>http://serilog.net/images/serilog-sink-nuget.png</PackageIconUrl>
1614
<PackageProjectUrl>http://serilog.net</PackageProjectUrl>
@@ -20,10 +18,7 @@
2018
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
2119
<RootNamespace>Serilog</RootNamespace>
2220
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
23-
<AssemblyName>Serilog.Sinks.File</AssemblyName>
24-
<!-- Don't reference the full NETStandard.Library -->
2521
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
26-
<!-- SourceLink configuration -->
2722
<EnableSourceLink Condition="'$(EnableSourceLink)' == ''">false</EnableSourceLink>
2823
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2924
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

src/Serilog.Sinks.File/Sinks/File/RollingFileSink.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using Serilog.Debugging;
2121
using Serilog.Events;
2222
using Serilog.Formatting;
23-
using System.Collections.Generic;
2423

2524
namespace Serilog.Sinks.File
2625
{
@@ -216,7 +215,7 @@ void ApplyRetentionPolicy(string currentFilePath, DateTime now)
216215

217216
bool ShouldRetainFile(RollingLogFile file, int index, DateTime now)
218217
{
219-
if (_retainedFileCountLimit.HasValue && index >= _retainedFileCountLimit.Value)
218+
if (_retainedFileCountLimit.HasValue && index >= _retainedFileCountLimit.Value - 1)
220219
return false;
221220

222221
if (_retainedFileTimeLimit.HasValue && file.DateTime.HasValue &&

test/Serilog.Sinks.File.Tests/RollingFileSinkTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Serilog.Events;
99
using Serilog.Sinks.File.Tests.Support;
1010
using Serilog.Configuration;
11+
using Serilog.Core;
1112

1213
namespace Serilog.Sinks.File.Tests
1314
{
@@ -142,7 +143,7 @@ public void WhenRetentionCountAndArchivingHookIsSetOldFilesAreCopiedAndOriginalD
142143
files =>
143144
{
144145
Assert.Equal(3, files.Count);
145-
Assert.True(!System.IO.File.Exists(files[0]));
146+
Assert.False(System.IO.File.Exists(files[0]));
146147
Assert.True(System.IO.File.Exists(files[1]));
147148
Assert.True(System.IO.File.Exists(files[2]));
148149
Assert.True(System.IO.File.Exists(ArchiveOldLogsHook.AddTopDirectory(files[0], archiveDirectory)));
@@ -241,7 +242,7 @@ public void IfTheLogFolderDoesNotExistItWillBeCreated()
241242
var folder = Path.Combine(temp, Guid.NewGuid().ToString());
242243
var pathFormat = Path.Combine(folder, fileName);
243244

244-
ILogger log = null;
245+
Logger log = null;
245246

246247
try
247248
{
@@ -255,8 +256,7 @@ public void IfTheLogFolderDoesNotExistItWillBeCreated()
255256
}
256257
finally
257258
{
258-
var disposable = (IDisposable)log;
259-
if (disposable != null) disposable.Dispose();
259+
log?.Dispose();
260260
Directory.Delete(temp, true);
261261
}
262262
}

0 commit comments

Comments
 (0)