From 1a43216d00e6f5210695b9fd2eea4810a63015ea Mon Sep 17 00:00:00 2001 From: Teng Li Date: Thu, 20 Aug 2020 15:02:40 -0700 Subject: [PATCH 1/3] Flip the boolean for IsPackable. --- .../Microsoft.Health.Tests.Common.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj b/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj index 1b45e507..a1dbc571 100644 --- a/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj +++ b/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj @@ -1,7 +1,7 @@  netcoreapp3.1 - false + true ..\..\CustomAnalysisRules.Test.ruleset true Off From 20f0f8d260171d2951d1c3f37dce8f0e03cb7c9d Mon Sep 17 00:00:00 2001 From: Teng Li Date: Thu, 20 Aug 2020 15:29:38 -0700 Subject: [PATCH 2/3] Update testing data provider to take multiple testing files. --- .../FileDataAttribute.cs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/Microsoft.Health.Tests.Common/FileDataAttribute.cs b/test/Microsoft.Health.Tests.Common/FileDataAttribute.cs index 530db904..f2d4c024 100644 --- a/test/Microsoft.Health.Tests.Common/FileDataAttribute.cs +++ b/test/Microsoft.Health.Tests.Common/FileDataAttribute.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using System.Reflection; using Xunit.Sdk; @@ -12,23 +13,29 @@ namespace Microsoft.Health.Tests.Common { public class FileDataAttribute : DataAttribute { - private readonly string _filePath; + private readonly string[] _filePaths; - public FileDataAttribute(string filePath) + public FileDataAttribute(params string[] filePaths) { - _filePath = filePath; + _filePaths = filePaths; } public override IEnumerable GetData(MethodInfo testMethod) { - var path = Path.IsPathRooted(_filePath) ? _filePath : Path.Combine(Directory.GetCurrentDirectory(), _filePath); - - if (!File.Exists(path)) + ICollection fileContents = new List(); + foreach (string filePath in _filePaths) { - throw new FileNotFoundException($"File {path} not found."); + var path = Path.IsPathRooted(filePath) ? filePath : Path.Combine(Directory.GetCurrentDirectory(), filePath); + + if (!File.Exists(path)) + { + throw new FileNotFoundException($"File {path} not found."); + } + + fileContents.Add(File.ReadAllText(path)); } - yield return new[] { File.ReadAllText(path) }; + yield return fileContents.ToArray(); } } } From 134ac41fa60f14dbe62796e030640d7cd724f2a0 Mon Sep 17 00:00:00 2001 From: Teng Li Date: Thu, 20 Aug 2020 17:43:48 -0700 Subject: [PATCH 3/3] Change dependency to make it compatible with .net framework. --- .../Microsoft.Health.Tests.Common.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj b/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj index a1dbc571..c5639a3a 100644 --- a/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj +++ b/test/Microsoft.Health.Tests.Common/Microsoft.Health.Tests.Common.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + netstandard2.0 true ..\..\CustomAnalysisRules.Test.ruleset true @@ -18,8 +18,8 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + -