|
1 | 1 | using System; |
| 2 | +using System.IO; |
| 3 | +using System.Reflection; |
2 | 4 | using Microsoft.Build.Logging; |
3 | 5 | using Microsoft.Build.Logging.StructuredLogger; |
4 | 6 | using StructuredLogger.Tests; |
@@ -32,32 +34,34 @@ public BinaryLoggerTests(ITestOutputHelper output) |
32 | 34 | [Fact] |
33 | 35 | public void TestBinaryLoggerRoundtrip() |
34 | 36 | { |
35 | | - var binLog = "1.binlog"; |
| 37 | + var binLog = GetFullPath("1.binlog"); |
36 | 38 | var binaryLogger = new BinaryLogger(); |
37 | 39 | binaryLogger.Parameters = binLog; |
38 | 40 | MSBuild.BuildProject(s_testProject, binaryLogger); |
39 | 41 |
|
40 | 42 | 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); |
43 | 45 |
|
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")); |
48 | 49 |
|
49 | | - Assert.False(Differ.AreDifferent("1.xml", "2.xml")); |
| 50 | + Assert.False(Differ.AreDifferent(xml1, GetFullPath("2.xml"))); |
50 | 51 |
|
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"))); |
55 | 55 |
|
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")); |
59 | 58 |
|
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); |
61 | 65 | } |
62 | 66 |
|
63 | 67 | private static string GetProperty(Logging.StructuredLogger.Build build) |
|
0 commit comments