diff --git a/ClosedXML_Tests/Excel/Columns/ColumnTests.cs b/ClosedXML_Tests/Excel/Columns/ColumnTests.cs index 0a98c4f..dc452c7 100644 --- a/ClosedXML_Tests/Excel/Columns/ColumnTests.cs +++ b/ClosedXML_Tests/Excel/Columns/ColumnTests.cs @@ -107,7 +107,7 @@ IXLColumn column3 = ws.Column(3); IXLColumn columnIns = ws.Column(2).InsertColumnsBefore(1).First(); - string outputPath = Path.Combine(TestHelper.TestsOutputDirectory, @"ForTesting\Sandbox.xlsx"); + string outputPath = Path.Combine(TestHelper.TestsOutputDirectory, "ForTesting", "Sandbox.xlsx"); wb.SaveAs(outputPath); Assert.AreEqual(XLColor.Red, ws.Column(1).Cell(1).Style.Fill.BackgroundColor); diff --git a/ClosedXML_Tests/Excel/Misc/CopyContentsTests.cs b/ClosedXML_Tests/Excel/Misc/CopyContentsTests.cs index ce055cc..c9c77f6 100644 --- a/ClosedXML_Tests/Excel/Misc/CopyContentsTests.cs +++ b/ClosedXML_Tests/Excel/Misc/CopyContentsTests.cs @@ -113,7 +113,7 @@ copyRowSheet.Cell("G2").Value = "must be removed after copy"; originalRow.CopyTo(destinationRow); } - TestHelper.SaveWorkbook(workbook, @"Misc\CopyRowContents.xlsx"); + TestHelper.SaveWorkbook(workbook, "Misc", "CopyRowContents.xlsx"); } } } \ No newline at end of file diff --git a/ClosedXML_Tests/TestHelper.cs b/ClosedXML_Tests/TestHelper.cs index be509a2..02c8884 100644 --- a/ClosedXML_Tests/TestHelper.cs +++ b/ClosedXML_Tests/TestHelper.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.IO; using System.Threading; using ClosedXML.Excel; @@ -32,9 +34,9 @@ private static readonly ResourceFileExtractor _extractor = new ResourceFileExtractor(null, ".Resource.Examples."); - public static void SaveWorkbook(XLWorkbook workbook, string fileName) + public static void SaveWorkbook(XLWorkbook workbook, params string[] fileNameParts) { - workbook.SaveAs(Path.Combine(TestsOutputDirectory, fileName)); + workbook.SaveAs(Path.Combine(new string[] { TestsOutputDirectory }.Concat(fileNameParts).ToArray())); } public static void RunTestExample(string filePartName) @@ -44,7 +46,8 @@ Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); var example = new T(); - string filePath1 = Path.Combine(TestsExampleOutputDirectory, filePartName); + string[] pathParts = filePartName.Split(new char[] {'\\'}); + string filePath1 = Path.Combine(new List() { TestsExampleOutputDirectory }.Concat(pathParts).ToArray()); var extension = Path.GetExtension(filePath1); var directory = Path.GetDirectoryName(filePath1);