Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSantiago Fernandez Madero <safern@microsoft.com>2017-03-17 03:17:07 +0300
committerGitHub <noreply@github.com>2017-03-17 03:17:07 +0300
commit115bbebd35ae6a7323a70c8aa61cab03d65a1eee (patch)
treed7401514bc70b4a3b380ee26c46e1124f8ec36d3 /src
parentae6bf515460f425096df92e4305f2e324c5bb9ed (diff)
Fix System.ComponentModel.TypeConverter failing tests (#17206)
* System.ComponentModel.TypeConverter failing tests
Diffstat (limited to 'src')
-rw-r--r--src/Common/tests/System/PlatformDetection.cs2
-rw-r--r--src/System.ComponentModel.TypeConverter/dir.props3
-rw-r--r--src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs10
-rw-r--r--src/System.ComponentModel.TypeConverter/tests/SampleClasses.cs4
-rw-r--r--src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj3
-rw-r--r--src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj3
-rw-r--r--src/System.Diagnostics.TraceSource/tests/TraceClassTests.cs2
-rw-r--r--src/System.Diagnostics.TraceSource/tests/TraceSourceClassTests.cs2
-rw-r--r--src/System.Diagnostics.TraceSource/tests/TraceTestHelper.cs2
-rw-r--r--src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs2
-rw-r--r--src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj3
-rw-r--r--src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs2
-rw-r--r--src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj3
13 files changed, 32 insertions, 9 deletions
diff --git a/src/Common/tests/System/PlatformDetection.cs b/src/Common/tests/System/PlatformDetection.cs
index ae750dcde9..7f6ab90251 100644
--- a/src/Common/tests/System/PlatformDetection.cs
+++ b/src/Common/tests/System/PlatformDetection.cs
@@ -12,6 +12,8 @@ namespace System
{
public static class PlatformDetection
{
+ public static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase);
+
public static bool IsWindows { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
public static bool IsWindows7 { get; } = IsWindows && GetWindowsVersion() == 6 && GetWindowsMinorVersion() == 1;
public static bool IsWindows8x { get; } = IsWindows && GetWindowsVersion() == 6 && (GetWindowsMinorVersion() == 2 || GetWindowsMinorVersion() == 3);
diff --git a/src/System.ComponentModel.TypeConverter/dir.props b/src/System.ComponentModel.TypeConverter/dir.props
index e35a1e8a9f..27918bd646 100644
--- a/src/System.ComponentModel.TypeConverter/dir.props
+++ b/src/System.ComponentModel.TypeConverter/dir.props
@@ -2,7 +2,8 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
- <AssemblyVersion>4.2.0.0</AssemblyVersion>
+ <!-- don't change the Asssembly Version as one test would break -->
+ <AssemblyVersion>9.9.9.9</AssemblyVersion>
<IsNETCoreApp>true</IsNETCoreApp>
<IsUAP>true</IsUAP>
</PropertyGroup>
diff --git a/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs b/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs
index 8e35a6d65e..fc866bb4f6 100644
--- a/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs
+++ b/src/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs
@@ -9,6 +9,16 @@ namespace System.ComponentModel.Tests
{
public class MemberDescriptorTests
{
+ static MemberDescriptorTests()
+ {
+ if (PlatformDetection.IsFullFramework)
+ {
+ // MethodDescriptor.Equals checks for this quirk and if it is set to true the behavior will be different to what we expect and the test will fail.
+ // This quirk is set to true by default on .NET versions earlier than 4.6.1 and Xunit runner was built against 4.5, so we override the quirk value to have the expected behavior.
+ AppContext.SetSwitch(@"Switch.System.MemberDescriptorEqualsReturnsFalseIfEquivalent", false);
+ }
+ }
+
[Fact]
public void CopiedMemberDescriptorEqualsItsSource()
{
diff --git a/src/System.ComponentModel.TypeConverter/tests/SampleClasses.cs b/src/System.ComponentModel.TypeConverter/tests/SampleClasses.cs
index 3608d1ad25..7ae6d6894f 100644
--- a/src/System.ComponentModel.TypeConverter/tests/SampleClasses.cs
+++ b/src/System.ComponentModel.TypeConverter/tests/SampleClasses.cs
@@ -83,9 +83,9 @@ namespace System.ComponentModel.Tests
}
#if FUNCTIONAL_TESTS
- [TypeConverter("System.ComponentModel.Tests.BaseClassConverter, System.ComponentModel.TypeConverter.Tests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
+ [TypeConverter("System.ComponentModel.Tests.BaseClassConverter, System.ComponentModel.TypeConverter.Tests, Version=9.9.9.9, Culture=neutral, PublicKeyToken=9d77cc7ad39b68eb")]
#elif PERFORMANCE_TESTS
- [TypeConverter("System.ComponentModel.Tests.BaseClassConverter, System.ComponentModel.TypeConverter.Performance.Tests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
+ [TypeConverter("System.ComponentModel.Tests.BaseClassConverter, System.ComponentModel.TypeConverter.Performance.Tests, Version=9.9.9.9, Culture=neutral, PublicKeyToken=9d77cc7ad39b68eb")]
#else
#error Define FUNCTIONAL_TESTS or PERFORMANCE_TESTS
#endif
diff --git a/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj b/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj
index 3a4616e681..fbe50deed9 100644
--- a/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj
+++ b/src/System.ComponentModel.TypeConverter/tests/System.ComponentModel.TypeConverter.Tests.csproj
@@ -19,6 +19,9 @@
<Compile Include="Drawing\SizeFConverterTests.cs" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
+ <Link>Common\tests\System\PlatformDetection.cs</Link>
+ </Compile>
<Compile Include="ArrayConverterTests.cs" />
<Compile Include="AttributeCollectionTests.cs" />
<Compile Include="AttributeProviderAttributeTests.cs" />
diff --git a/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj b/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj
index 21f56fbd76..80cdcf4c23 100644
--- a/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj
+++ b/src/System.Diagnostics.TraceSource/tests/System.Diagnostics.TraceSource.Tests.csproj
@@ -34,6 +34,9 @@
<Compile Include="$(CommonTestPath)\System\IO\FileCleanupTestBase.cs">
<Link>Common\System\IO\FileCleanupTestBase.cs</Link>
</Compile>
+ <Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
+ <Link>Common\tests\System\PlatformDetection.cs</Link>
+ </Compile>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
diff --git a/src/System.Diagnostics.TraceSource/tests/TraceClassTests.cs b/src/System.Diagnostics.TraceSource/tests/TraceClassTests.cs
index 660c2758cb..c5d6b9b926 100644
--- a/src/System.Diagnostics.TraceSource/tests/TraceClassTests.cs
+++ b/src/System.Diagnostics.TraceSource/tests/TraceClassTests.cs
@@ -12,7 +12,7 @@ namespace System.Diagnostics.TraceSourceTests
public class TraceClassTests : IDisposable
{
- private readonly string TestRunnerAssemblyName = TraceTestHelper.IsFullFramework ?
+ private readonly string TestRunnerAssemblyName = PlatformDetection.IsFullFramework ?
Path.GetFileName(Environment.GetCommandLineArgs()[0]) : Assembly.GetEntryAssembly().GetName().Name;
void IDisposable.Dispose()
diff --git a/src/System.Diagnostics.TraceSource/tests/TraceSourceClassTests.cs b/src/System.Diagnostics.TraceSource/tests/TraceSourceClassTests.cs
index b535f8e502..35802b0c01 100644
--- a/src/System.Diagnostics.TraceSource/tests/TraceSourceClassTests.cs
+++ b/src/System.Diagnostics.TraceSource/tests/TraceSourceClassTests.cs
@@ -135,7 +135,7 @@ namespace System.Diagnostics.TraceSourceTests
ArgumentException exception2 = Assert.Throws<ArgumentException>(() => new TraceSource(string.Empty, SourceLevels.All));
// In Desktop in TraceSource.ctor we create the ArgumentException without param name, just with Message = "name", so ParamName is null
- if (TraceTestHelper.IsFullFramework)
+ if (PlatformDetection.IsFullFramework)
{
Assert.Null(exception1.ParamName);
Assert.Null(exception2.ParamName);
diff --git a/src/System.Diagnostics.TraceSource/tests/TraceTestHelper.cs b/src/System.Diagnostics.TraceSource/tests/TraceTestHelper.cs
index 4945991689..2768a67033 100644
--- a/src/System.Diagnostics.TraceSource/tests/TraceTestHelper.cs
+++ b/src/System.Diagnostics.TraceSource/tests/TraceTestHelper.cs
@@ -9,8 +9,6 @@ namespace System.Diagnostics.TraceSourceTests
{
static class TraceTestHelper
{
- internal static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase);
-
/// <summary>
/// Resets the static state of the trace objects before a unit test.
/// </summary>
diff --git a/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs b/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs
index be1c7d2ad1..485b221843 100644
--- a/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs
+++ b/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs
@@ -125,7 +125,7 @@ namespace System.Reflection.Emit.Tests
Assert.Equal("<In Memory Module>", module.Name);
// The coreclr ignores the name passed to AssemblyBuilder.DefineDynamicModule
- if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework"))
+ if (PlatformDetection.IsFullFramework)
{
Assert.Equal(name, module.FullyQualifiedName);
}
diff --git a/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj b/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj
index 7a7778f729..c9aee4d8c6 100644
--- a/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj
+++ b/src/System.Reflection.Emit/tests/System.Reflection.Emit.Tests.csproj
@@ -8,6 +8,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<ItemGroup>
+ <Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
+ <Link>Common\tests\System\PlatformDetection.cs</Link>
+ </Compile>
<Compile Include="AssemblyBuilderTests.cs" />
<Compile Include="ConstructorBuilder\ConstructorBuilderDefineParameter.cs" />
<Compile Include="ConstructorBuilder\ConstructorBuilderGetILGenerator.cs" />
diff --git a/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs b/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs
index 687e8dbd23..311c0b53c7 100644
--- a/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs
+++ b/src/System.Text.RegularExpressions/tests/Regex.Ctor.Tests.cs
@@ -272,7 +272,7 @@ namespace System.Text.RegularExpressions.Tests
[InlineData(" (?(?n))", RegexOptions.None, typeof(OutOfMemoryException))]
public void Ctor_InvalidPattern(string pattern, RegexOptions options, Type exceptionType)
{
- if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework"))
+ if (PlatformDetection.IsFullFramework)
{
Assert.Throws(exceptionType, () => new Regex(pattern, options));
}
diff --git a/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj b/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj
index b58dd9c784..eaae38b42e 100644
--- a/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj
+++ b/src/System.Text.RegularExpressions/tests/System.Text.RegularExpressions.Tests.csproj
@@ -12,6 +12,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup>
+ <Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
+ <Link>Common\tests\System\PlatformDetection.cs</Link>
+ </Compile>
<Compile Include="CaptureCollectionTests.cs" />
<Compile Include="GroupCollectionTests.cs" />
<Compile Include="MatchCollectionTests.cs" />