未验证 提交 b14a2138 编写于 作者: L Lakshan Fernando 提交者: GitHub

Fix component model aot test (#73734)

* Partial fix for ComponentModel.TypeConverter tests

* Fix ComponentModel.TypeConverter tests

* enable the test proj

* FB

* working around a test build fail

* Update src/libraries/System.ComponentModel.TypeConverter/tests/BindableAttributeTests.cs
Co-authored-by: NMichal Strehovský <MichalStrehovsky@users.noreply.github.com>

* Update src/libraries/tests.proj
Co-authored-by: NMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: NMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
上级 afc9675d
......@@ -42,7 +42,7 @@ internal ExecutionDomain(ReflectionDomainSetup executionDomainSetup, ExecutionEn
public Type GetType(string typeName, Func<AssemblyName, Assembly> assemblyResolver, Func<Assembly, string, bool, Type> typeResolver, bool throwOnError, bool ignoreCase, IList<string> defaultAssemblyNames)
{
if (typeName == null)
throw new ArgumentNullException();
throw new ArgumentNullException(nameof(typeName));
if (typeName.Length == 0)
{
......
......@@ -13,7 +13,7 @@ namespace System.ComponentModel.Tests
[Collection(nameof(DisableParallelization))] // manipulates cache
public class TypeDescriptorTests
{
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProvider_InvokeObject_GetProviderReturnsExpected()
{
var instance = new object();
......@@ -47,7 +47,7 @@ public void AddProvider_InvokeObject_GetProviderReturnsExpected()
mockProvider2.Verify(p => p.IsSupportedType(typeof(int)), Times.Once());
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProvider_InvokeObjectMultipleTimes_Refreshes()
{
var instance = new object();
......@@ -96,7 +96,7 @@ public void AddProvider_InvokeObjectMultipleTimes_Refreshes()
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProvider_InvokeType_GetProviderReturnsExpected()
{
Type type = typeof(AddProvider_InvokeType_GetProviderReturnsExpectedType);
......@@ -133,7 +133,7 @@ public void AddProvider_InvokeType_GetProviderReturnsExpected()
private class AddProvider_InvokeType_GetProviderReturnsExpectedType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProvider_InvokeTypeMultipleTimes_Refreshes()
{
var type = typeof(AddProvider_InvokeTypeMultipleTimes_RefreshesType);
......@@ -184,28 +184,28 @@ public void AddProvider_InvokeTypeMultipleTimes_Refreshes()
private class AddProvider_InvokeTypeMultipleTimes_RefreshesType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProvider_NullProvider_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>("provider", () => TypeDescriptor.AddProvider(null, new object()));
Assert.Throws<ArgumentNullException>("provider", () => TypeDescriptor.AddProvider(null, typeof(int)));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProvider_NullInstance_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
Assert.Throws<ArgumentNullException>("instance", () => TypeDescriptor.AddProvider(mockProvider.Object, (object)null));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProvider_NullType_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
Assert.Throws<ArgumentNullException>("type", () => TypeDescriptor.AddProvider(mockProvider.Object, null));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProviderTransparent_InvokeObject_GetProviderReturnsExpected()
{
var instance = new object();
......@@ -239,7 +239,7 @@ public void AddProviderTransparent_InvokeObject_GetProviderReturnsExpected()
mockProvider2.Verify(p => p.IsSupportedType(typeof(int)), Times.Once());
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProviderTransparent_InvokeObjectMultipleTimes_Refreshes()
{
var instance = new object();
......@@ -288,7 +288,7 @@ public void AddProviderTransparent_InvokeObjectMultipleTimes_Refreshes()
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProviderTransparent_InvokeType_GetProviderReturnsExpected()
{
Type type = typeof(AddProviderTransparent_InvokeType_GetProviderReturnsExpectedType);
......@@ -324,7 +324,7 @@ public void AddProviderTransparent_InvokeType_GetProviderReturnsExpected()
private class AddProviderTransparent_InvokeType_GetProviderReturnsExpectedType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProviderTransparent_InvokeTypeMultipleTimes_Refreshes()
{
var type = typeof(AddProviderTransparent_InvokeTypeMultipleTimes_RefreshesType);
......@@ -375,21 +375,21 @@ public void AddProviderTransparent_InvokeTypeMultipleTimes_Refreshes()
private class AddProviderTransparent_InvokeTypeMultipleTimes_RefreshesType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProviderTransparent_NullProvider_ThrowsArgumentNullException()
{
Assert.Throws<ArgumentNullException>("provider", () => TypeDescriptor.AddProviderTransparent(null, new object()));
Assert.Throws<ArgumentNullException>("provider", () => TypeDescriptor.AddProviderTransparent(null, typeof(int)));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProviderTransparent_NullInstance_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
Assert.Throws<ArgumentNullException>("instance", () => TypeDescriptor.AddProviderTransparent(mockProvider.Object, (object)null));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void AddProviderTransparent_NullType_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
......@@ -548,7 +548,7 @@ public void GetPropertiesFiltersByAttribute()
Assert.Equal(1, properties.Count);
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_InvokeObject_RemovesProvider()
{
var instance = new object();
......@@ -603,7 +603,7 @@ public void RemoveProvider_InvokeObject_RemovesProvider()
mockProvider3.Verify(p => p.IsSupportedType(typeof(int)), Times.Once());
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_InvokeObjectWithProviders_Refreshes()
{
var instance = new object();
......@@ -640,7 +640,7 @@ public void RemoveProvider_InvokeObjectWithProviders_Refreshes()
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_InvokeObjectWithoutProviders_Refreshes()
{
var instance = new object();
......@@ -665,7 +665,7 @@ public void RemoveProvider_InvokeObjectWithoutProviders_Refreshes()
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_InvokeType_RemovesProvider()
{
Type type = typeof(RemoveProvider_InvokeType_RemovesProviderType);
......@@ -722,7 +722,7 @@ public void RemoveProvider_InvokeType_RemovesProvider()
private class RemoveProvider_InvokeType_RemovesProviderType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_InvokeTypeWithProviders_Refreshes()
{
Type type = typeof(RemoveProvider_InvokeObjectWithProviders_RefreshesType);
......@@ -761,7 +761,7 @@ public void RemoveProvider_InvokeTypeWithProviders_Refreshes()
private class RemoveProvider_InvokeObjectWithProviders_RefreshesType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_InvokeTypeWithoutProviders_Refreshes()
{
Type type = typeof(RemoveProvider_InvokeTypeWithoutProviders_RefreshesType);
......@@ -795,14 +795,14 @@ public void RemoveProvider_NullProvider_ThrowsArgumentNullException()
Assert.Throws<ArgumentNullException>("provider", () => TypeDescriptor.RemoveProvider(null, typeof(int)));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_NullInstance_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
Assert.Throws<ArgumentNullException>("instance", () => TypeDescriptor.RemoveProvider(mockProvider.Object, (object)null));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProvider_NullType_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
......@@ -810,7 +810,7 @@ public void RemoveProvider_NullType_ThrowsArgumentNullException()
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_InvokeObject_RemovesProvider()
{
var instance = new object();
......@@ -865,7 +865,7 @@ public void RemoveProviderTransparent_InvokeObject_RemovesProvider()
mockProvider3.Verify(p => p.IsSupportedType(typeof(int)), Times.Once());
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_InvokeObjectWithProviders_Refreshes()
{
var instance = new object();
......@@ -902,7 +902,7 @@ public void RemoveProviderTransparent_InvokeObjectWithProviders_Refreshes()
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_InvokeObjectWithoutProviders_Refreshes()
{
var instance = new object();
......@@ -927,7 +927,7 @@ public void RemoveProviderTransparent_InvokeObjectWithoutProviders_Refreshes()
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_InvokeType_RemovesProvider()
{
Type type = typeof(RemoveProviderTransparent_InvokeType_RemovesProviderType);
......@@ -984,7 +984,7 @@ public void RemoveProviderTransparent_InvokeType_RemovesProvider()
private class RemoveProviderTransparent_InvokeType_RemovesProviderType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_InvokeTypeWithProviders_Refreshes()
{
Type type = typeof(RemoveProviderTransparent_InvokeObjectWithProviders_RefreshesType);
......@@ -1023,7 +1023,7 @@ public void RemoveProviderTransparent_InvokeTypeWithProviders_Refreshes()
private class RemoveProviderTransparent_InvokeObjectWithProviders_RefreshesType { }
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_InvokeTypeWithoutProviders_Refreshes()
{
Type type = typeof(RemoveProviderTransparent_InvokeTypeWithoutProviders_RefreshesType);
......@@ -1057,14 +1057,14 @@ public void RemoveProviderTransparent_NullProvider_ThrowsArgumentNullException()
Assert.Throws<ArgumentNullException>("provider", () => TypeDescriptor.RemoveProviderTransparent(null, typeof(int)));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_NullInstance_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
Assert.Throws<ArgumentNullException>("instance", () => TypeDescriptor.RemoveProviderTransparent(mockProvider.Object, (object)null));
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void RemoveProviderTransparent_NullType_ThrowsArgumentNullException()
{
var mockProvider = new Mock<TypeDescriptionProvider>(MockBehavior.Strict);
......@@ -1111,7 +1111,7 @@ public void RemoveSingleAssociation()
Assert.NotEqual(firstAssociatedObject, firstAssociation);
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoAOT))] // Mock will try to JIT
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] // Mock will try to JIT
public void SortDescriptorArray_Invoke_ReturnsExpected()
{
var notADescriptor1 = new object();
......
......@@ -12,7 +12,7 @@ namespace System.Xml.Linq.Tests
{
public class XTypeDescriptionProviderTests
{
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void XAttributeValuePropertyDescriptor()
{
var xatt = new XAttribute("someAttribute", "someValue");
......@@ -41,7 +41,7 @@ public void XAttributeValuePropertyDescriptor()
Assert.Equal(newValue, xatt.Value);
}
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void XElementAttributePropertyDescriptor()
{
var xel = new XElement("someElement");
......@@ -117,7 +117,7 @@ public void XElementAttributePropertyDescriptor()
Assert.True(valueChanged);
}
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void XElementDescendantsPropertyDescriptor()
{
var xel = new XElement("someElement");
......@@ -150,7 +150,7 @@ public void XElementDescendantsPropertyDescriptor()
Assert.True(valueChanged);
}
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void XElementElementPropertyDescriptor()
{
var xel = new XElement("someElement");
......@@ -225,7 +225,7 @@ public void XElementElementPropertyDescriptor()
Assert.True(valueChanged);
}
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void XElementElementsPropertyDescriptor()
{
var xel = new XElement("someElement");
......@@ -258,7 +258,7 @@ public void XElementElementsPropertyDescriptor()
Assert.True(valueChanged);
}
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void XElementValuePropertyDescriptor()
{
var xel = new XElement("someElement", "someValue");
......@@ -292,7 +292,7 @@ public void XElementValuePropertyDescriptor()
Assert.Equal(xel.Value, xelValPD.GetValue(xel));
}
[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNativeAot))]
public void XElementXmlPropertyDescriptor()
{
var xel = new XElement("someElement");
......
......@@ -503,7 +503,6 @@
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.CodeDom\tests\System.CodeDom.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.ComponentModel.Composition\tests\System.ComponentModel.Composition.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.ComponentModel.Composition.Registration\tests\System.ComponentModel.Composition.Registration.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.ComponentModel.TypeConverter\tests\System.ComponentModel.TypeConverter.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Composition\tests\System.Composition.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Composition.Hosting\tests\System.Composition.Hosting.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Composition.TypedParts\tests\System.Composition.TypedParts.Tests.csproj" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册