Skip to content

Commit af6ef6d

Browse files
TurnerjRehanSaeed
authored andcommitted
Add testing support for .NET Framework (#113)
* Add testing support for .NET Framework The StringExtensions class is to work around the combination of multiple calls to these specific methods with those methods not being supported in .NET Framework and the linting requiring these calls in .NET Core. * .NET 4.7.2 targeting pack for non-Windows systems * Add missing framework path overrides based on xUnit docs * Include System.Runtime reference * Added System.Threading.Tasks reference * Reverting the more complicated .NET Framework support config * Potential fix for cross-platform testing For exception: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1 parent a01ef07 commit af6ef6d

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Tests/Schema.NET.Test/Schema.NET.Test.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup Label="Build">
4-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
55
<CodeAnalysisRuleSet>../../MinimumRecommendedRulesWithStyleCop.ruleset</CodeAnalysisRuleSet>
66
<LangVersion>latest</LangVersion>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -12,7 +12,10 @@
1212
</ItemGroup>
1313

1414
<ItemGroup Label="Package References">
15+
<!-- See https://github.com/Microsoft/dotnet/tree/master/releases/reference-assemblies -->
16+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
1517
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
18+
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.4.0" />
1619
<PackageReference Include="Moq" Version="4.13.1" />
1720
<PackageReference Include="xunit" Version="2.4.1" />
1821
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#if NET472
2+
namespace Schema.NET.Test
3+
{
4+
using System;
5+
6+
#pragma warning disable IDE0060 // Remove unused parameter
7+
#pragma warning disable CA1801 // Remove unused parameter
8+
9+
public static class StringExtensions
10+
{
11+
public static string Replace(this string target, string oldValue, string newValue, StringComparison stringComparison) => target.Replace(oldValue, newValue);
12+
13+
public static int GetHashCode(this string target, StringComparison stringComparison) => target.GetHashCode();
14+
}
15+
16+
#pragma warning restore CA1801 // Remove unused parameter
17+
#pragma warning restore IDE0060 // Remove unused parameter
18+
}
19+
#endif

0 commit comments

Comments
 (0)