Skip to content

Commit e4a138a

Browse files
committed
Fix test.
1 parent b06d2ce commit e4a138a

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

src/StructuredLogger.Tests/BinaryLoggerTests.cs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using System.IO;
3+
using System.Reflection;
24
using Microsoft.Build.Logging;
35
using Microsoft.Build.Logging.StructuredLogger;
46
using StructuredLogger.Tests;
@@ -32,32 +34,34 @@ public BinaryLoggerTests(ITestOutputHelper output)
3234
[Fact]
3335
public void TestBinaryLoggerRoundtrip()
3436
{
35-
var binLog = "1.binlog";
37+
var binLog = GetFullPath("1.binlog");
3638
var binaryLogger = new BinaryLogger();
3739
binaryLogger.Parameters = binLog;
3840
MSBuild.BuildProject(s_testProject, binaryLogger);
3941

4042
var build = Serialization.Read(binLog);
41-
Assert.Equal("", GetProperty(build));
42-
Serialization.Write(build, "1.xml");
43+
var xml1 = GetFullPath("1.xml");
44+
Serialization.Write(build, xml1);
4345

44-
Serialization.Write(build, "1.buildlog");
45-
build = Serialization.Read("1.buildlog");
46-
Assert.Equal("", GetProperty(build));
47-
Serialization.Write(build, "2.xml");
46+
Serialization.Write(build, GetFullPath("1.buildlog"));
47+
build = Serialization.Read(GetFullPath("1.buildlog"));
48+
Serialization.Write(build, GetFullPath("2.xml"));
4849

49-
Assert.False(Differ.AreDifferent("1.xml", "2.xml"));
50+
Assert.False(Differ.AreDifferent(xml1, GetFullPath("2.xml")));
5051

51-
build = XlinqLogReader.ReadFromXml("1.xml");
52-
Assert.Equal("", GetProperty(build));
53-
Serialization.Write(build, "3.xml");
54-
Assert.False(Differ.AreDifferent("1.xml", "3.xml"));
52+
build = XlinqLogReader.ReadFromXml(xml1);
53+
Serialization.Write(build, GetFullPath("3.xml"));
54+
Assert.False(Differ.AreDifferent(xml1, GetFullPath("3.xml")));
5555

56-
build = Serialization.Read("1.xml");
57-
Assert.Equal("", GetProperty(build));
58-
Serialization.Write(build, "4.xml");
56+
build = Serialization.Read(xml1);
57+
Serialization.Write(build, GetFullPath("4.xml"));
5958

60-
Assert.False(Differ.AreDifferent("1.xml", "4.xml"));
59+
Assert.False(Differ.AreDifferent(xml1, GetFullPath("4.xml")));
60+
}
61+
62+
private static string GetFullPath(string fileName)
63+
{
64+
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), fileName);
6165
}
6266

6367
private static string GetProperty(Logging.StructuredLogger.Build build)

0 commit comments

Comments
 (0)