-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add switch and Compat tests that simply reference existing tests
- Loading branch information
1 parent
37200dc
commit 6a36687
Showing
5 changed files
with
140 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/libraries/System.Resources.Extensions/tests/CompatTests/CompatSwitchTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Reflection; | ||
using Xunit; | ||
|
||
namespace System.Resources.Extensions.Compat.Tests | ||
{ | ||
public class CompatSwitchTests | ||
{ | ||
[Fact] | ||
public void TheFlagIsSet() | ||
{ | ||
FieldInfo fieldInfo = typeof(DeserializingResourceReader).GetField("UseBinaryFormatter", BindingFlags.NonPublic | BindingFlags.Static); | ||
|
||
Assert.True((bool)fieldInfo.GetValue(null)); | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...em.Resources.Extensions/tests/CompatTests/System.Resources.Extensions.Compat.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;</TargetFrameworks> | ||
<IncludeRemoteExecutor>true</IncludeRemoteExecutor> | ||
<CustomResourceTypesSupport Condition="'$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'">true</CustomResourceTypesSupport> | ||
<!-- some of the embeded resources have this assembly name hardcoded --> | ||
<AssemblyName>System.Resources.Extensions.Tests</AssemblyName> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="..\**\*.cs" /> | ||
<Compile Include="$(CoreLibSharedDir)System\Numerics\Hashing\HashHelpers.cs" | ||
Link="System\Numerics\Hashing\HashHelpers.cs" /> | ||
<Compile Include="..\..\src\System\Resources\Extensions\TypeNameComparer.cs" | ||
Link="TypeNameComparer.cs" /> | ||
<EmbeddedResource Include="..\TestData.resources" WithCulture="false" Type="Non-Resx" LogicalName="System.Resources.Extensions.Tests.%(FileName)%(Extension)" /> | ||
<None Include="runtimeconfig.template.json" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="System.Drawing.Common.TestData" Version="$(SystemDrawingCommonTestDataVersion)" /> | ||
<ProjectReference Include="..\..\src\System.Resources.Extensions.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'"> | ||
<PackageReference Include="System.Drawing.Common" Version="$(SystemDrawingCommonVersion)" /> | ||
<ProjectReference Include="$(LibrariesProjectRoot)System.Windows.Extensions\src\System.Windows.Extensions.csproj" Condition="'$(TargetPlatformIdentifier)' == 'windows'" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'"> | ||
<PackageReference Include="System.ValueTuple" Version="$(SystemValueTupleVersion)" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<!-- Apple mobile trimming descriptor for Mono runtime --> | ||
<TrimmerRootDescriptor Condition="'$(TargetsAppleMobile)' == 'true' and '$(EnableAggressiveTrimming)' == 'true' and '$(UseNativeAotRuntime)' != 'true'" Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" /> | ||
</ItemGroup> | ||
<!-- Use the following target to regenerate the test resources file. | ||
This is done from a test application and checked in so that we don't run | ||
product code during the build. | ||
Important: | ||
When invoking this target, pass the target framework in as well, substituting | ||
the X with the current major version: | ||
dotnet build -f netX.0-windows && cd outputdir && dotnet build -f netX.0-windows /t:GenerateTestResourcesFile. --> | ||
<Target Name="GenerateTestResourcesFile"> | ||
<PropertyGroup> | ||
<_executor>Microsoft.DotNet.RemoteExecutor.dll</_executor> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ExecuteMethod Class="System.Resources.Extensions.Tests.TestData" Include="WriteResources" Parameters="$(MSBuildProjectDirectory)\..\TestData.resources" /> | ||
<ExecuteMethod> | ||
<ExceptionFile>$(TargetDir)%(Class)%(Identity).exception.txt</ExceptionFile> | ||
</ExecuteMethod> | ||
<ExecuteMethod> | ||
<Command>$(NetCoreAppCurrentTestHostPath)dotnet exec --runtimeconfig $(TargetDir)$(TargetName).runtimeconfig.json $(_executor) $(AssemblyName) %(Class) %(Identity) %(ExceptionFile) %(Parameters)</Command> | ||
</ExecuteMethod> | ||
</ItemGroup> | ||
<Exec Command="%(ExecuteMethod.Command)" WorkingDirectory="$(TargetDir)" /> | ||
</Target> | ||
</Project> |
5 changes: 5 additions & 0 deletions
5
src/libraries/System.Resources.Extensions/tests/CompatTests/runtimeconfig.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"configProperties": { | ||
"System.Resources.Extensions.UseBinaryFormatter": true | ||
} | ||
} |