Skip to content

Commit 0b514f2

Browse files
committed
Proper path concatenation in tests
1 parent 6988cb4 commit 0b514f2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ public class PathRollerTests
1010
[Fact]
1111
public void TheLogFileIncludesDateToken()
1212
{
13-
var roller = new PathRoller("Logs\\log-.txt", RollingInterval.Day);
13+
var roller = new PathRoller(Path.Combine("Logs", "log-.txt"), RollingInterval.Day);
1414
var now = new DateTime(2013, 7, 14, 3, 24, 9, 980);
1515
string path;
1616
roller.GetLogFilePath(now, null, out path);
17-
AssertEqualAbsolute("Logs\\log-20130714.txt", path);
17+
AssertEqualAbsolute(Path.Combine("Logs", "log-20130714.txt"), path);
1818
}
1919

2020
[Fact]
2121
public void ANonZeroIncrementIsIncludedAndPadded()
2222
{
23-
var roller = new PathRoller("Logs\\log-.txt", RollingInterval.Day);
23+
var roller = new PathRoller(Path.Combine("Logs", "log-.txt"), RollingInterval.Day);
2424
var now = new DateTime(2013, 7, 14, 3, 24, 9, 980);
2525
string path;
2626
roller.GetLogFilePath(now, 12, out path);
27-
AssertEqualAbsolute("Logs\\log-20130714_012.txt", path);
27+
AssertEqualAbsolute(Path.Combine("Logs", "log-20130714_012.txt"), path);
2828
}
2929

3030
static void AssertEqualAbsolute(string path1, string path2)
@@ -37,18 +37,18 @@ static void AssertEqualAbsolute(string path1, string path2)
3737
[Fact]
3838
public void TheRollerReturnsTheLogFileDirectory()
3939
{
40-
var roller = new PathRoller("Logs\\log-.txt", RollingInterval.Day);
40+
var roller = new PathRoller(Path.Combine("Logs", "log-.txt"), RollingInterval.Day);
4141
AssertEqualAbsolute("Logs", roller.LogFileDirectory);
4242
}
4343

4444
[Fact]
4545
public void TheLogFileIsNotRequiredToIncludeAnExtension()
4646
{
47-
var roller = new PathRoller("Logs\\log-", RollingInterval.Day);
47+
var roller = new PathRoller(Path.Combine("Logs", "log-"), RollingInterval.Day);
4848
var now = new DateTime(2013, 7, 14, 3, 24, 9, 980);
4949
string path;
5050
roller.GetLogFilePath(now, null, out path);
51-
AssertEqualAbsolute("Logs\\log-20130714", path);
51+
AssertEqualAbsolute(Path.Combine("Logs", "log-20130714"), path);
5252
}
5353

5454
[Fact]
@@ -74,7 +74,7 @@ public void MatchingExcludesSimilarButNonmatchingFiles()
7474
[Fact]
7575
public void TheDirectorSearchPatternUsesWildcardInPlaceOfDate()
7676
{
77-
var roller = new PathRoller("Logs\\log-.txt", RollingInterval.Day);
77+
var roller = new PathRoller(Path.Combine("Logs", "log-.txt"), RollingInterval.Day);
7878
Assert.Equal("log-*.txt", roller.DirectorySearchPattern);
7979
}
8080

0 commit comments

Comments
 (0)