diff --git a/src/libraries/System.Linq/tests/EnumerableDebugViewTests.cs b/src/libraries/System.Linq/tests/EnumerableDebugViewTests.cs index f7aa1b7a272177..8e90d5b3c8c687 100644 --- a/src/libraries/System.Linq/tests/EnumerableDebugViewTests.cs +++ b/src/libraries/System.Linq/tests/EnumerableDebugViewTests.cs @@ -14,7 +14,7 @@ namespace System.Linq.Tests public class EnumerableDebugViewTests { - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] public void NonGenericEnumerableDebugView_ThrowsForNullSource() { Exception exc = Assert.Throws(() => CreateSystemCore_EnumerableDebugView(null)); @@ -22,7 +22,7 @@ public void NonGenericEnumerableDebugView_ThrowsForNullSource() Assert.Equal("enumerable", ane.ParamName); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] public void NonGenericEnumerableDebugView_ThrowsForEmptySource() { IEnumerable source = Enumerable.Range(10, 0); @@ -33,7 +33,7 @@ public void NonGenericEnumerableDebugView_ThrowsForEmptySource() Assert.False(string.IsNullOrEmpty(GetEmptyProperty(exc.InnerException))); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] public void NonGenericEnumerableDebugView_NonEmptySource() { IEnumerable source = Enumerable.Range(10, 5).Select(i => (object)i); @@ -41,7 +41,7 @@ public void NonGenericEnumerableDebugView_NonEmptySource() Assert.Equal(source.Cast().ToArray(), GetItems(debugView)); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] public void GenericEnumerableDebugView_ThrowsForNullSource() { Exception exc = Assert.Throws(() => CreateSystemCore_EnumerableDebugView(null)); @@ -49,7 +49,7 @@ public void GenericEnumerableDebugView_ThrowsForNullSource() Assert.Equal("enumerable", ane.ParamName); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] public void GenericEnumerableDebugView_ThrowsForEmptySource() { IEnumerable source = Enumerable.Range(10, 0); @@ -60,7 +60,7 @@ public void GenericEnumerableDebugView_ThrowsForEmptySource() Assert.False(string.IsNullOrEmpty(GetEmptyProperty(exc.InnerException))); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] public void GenericEnumerableDebugView_NonEmptySource() { IEnumerable source = Enumerable.Range(10, 5); diff --git a/src/libraries/System.Linq/tests/GroupByTests.DebuggerAttributes.cs b/src/libraries/System.Linq/tests/GroupByTests.DebuggerAttributes.cs index e9d001f591e7cb..1125fbabb05bb6 100644 --- a/src/libraries/System.Linq/tests/GroupByTests.DebuggerAttributes.cs +++ b/src/libraries/System.Linq/tests/GroupByTests.DebuggerAttributes.cs @@ -10,7 +10,7 @@ namespace System.Linq.Tests { public partial class GroupByTests : EnumerableTests { - [Theory] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] [MemberData(nameof(DebuggerAttributesValid_Data))] public void DebuggerAttributesValid(IGrouping grouping, string keyString) { diff --git a/src/libraries/System.Linq/tests/GroupByTests.cs b/src/libraries/System.Linq/tests/GroupByTests.cs index ee487a813c2367..4b8967a28a82e7 100644 --- a/src/libraries/System.Linq/tests/GroupByTests.cs +++ b/src/libraries/System.Linq/tests/GroupByTests.cs @@ -852,7 +852,7 @@ public void EmptyGroupingWithResultCount() Assert.Equal(0, Enumerable.Empty().GroupBy(i => i, (x, y) => x + y.Count()).Count()); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBuiltWithAggressiveTrimming))] public static void GroupingKeyIsPublic() { // Grouping.Key needs to be public (not explicitly implemented) for the sake of WPF. diff --git a/src/libraries/System.Linq/tests/System.Linq.Tests.csproj b/src/libraries/System.Linq/tests/System.Linq.Tests.csproj index 4f7231e72b4de5..1ea6a48d7382b2 100644 --- a/src/libraries/System.Linq/tests/System.Linq.Tests.csproj +++ b/src/libraries/System.Linq/tests/System.Linq.Tests.csproj @@ -3,6 +3,9 @@ $(NetCoreAppCurrent) true + + + diff --git a/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs b/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs index f26d25d095a068..ccbfc676de09c8 100644 --- a/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs +++ b/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs @@ -11,7 +11,7 @@ namespace System.Linq.Tests { public partial class ToLookupTests : EnumerableTests { - [Theory] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsDebuggerTypeProxyAttributeSupported))] [MemberData(nameof(DebuggerAttributesValid_Data))] public void DebuggerAttributesValid(ILookup lookup) { diff --git a/src/libraries/System.Linq/tests/default.rd.xml b/src/libraries/System.Linq/tests/default.rd.xml new file mode 100644 index 00000000000000..642dbd8db05922 --- /dev/null +++ b/src/libraries/System.Linq/tests/default.rd.xml @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Net.Mail/tests/Functional/MailMessageTest.cs b/src/libraries/System.Net.Mail/tests/Functional/MailMessageTest.cs index 99a0e7727c7c2d..dc871a4d6846b1 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/MailMessageTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/MailMessageTest.cs @@ -231,7 +231,7 @@ private static (string Raw, string Attachment) DecodeSentMailMessage(MailMessage { // Create a MIME message that would be sent using System.Net.Mail. var stream = new MemoryStream(); - var mailWriterType = mail.GetType().Assembly.GetType("System.Net.Mail.MailWriter"); + var mailWriterType = Type.GetType("System.Net.Mail.MailWriter, System.Net.Mail"); var mailWriter = Activator.CreateInstance( type: mailWriterType, bindingAttr: BindingFlags.Instance | BindingFlags.NonPublic, @@ -241,7 +241,7 @@ private static (string Raw, string Attachment) DecodeSentMailMessage(MailMessage activationAttributes: null); // Send the message. - mail.GetType().InvokeMember( + typeof(MailMessage).InvokeMember( name: "Send", invokeAttr: BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, binder: null, diff --git a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientCredentialsTest.cs b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientCredentialsTest.cs index b7618813ce902f..0206a22e38e982 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientCredentialsTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientCredentialsTest.cs @@ -118,7 +118,7 @@ public void Credentials_UseDefaultCredentialsSetTrueAfterCredentials_DefaultNetw private ICredentialsByHost GetTransportCredentials(SmtpClient client) { - Type smtpTransportType = (typeof(SmtpClient)).Assembly.GetType("System.Net.Mail.SmtpTransport"); + Type smtpTransportType = Type.GetType("System.Net.Mail.SmtpTransport, System.Net.Mail"); var transport = typeof(SmtpClient) .GetField("_transport", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance) diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/StartupTests.Windows.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/StartupTests.Windows.cs index 8f6503ca9c0fea..4666ea381ce8f3 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/StartupTests.Windows.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/StartupTests.Windows.cs @@ -15,7 +15,7 @@ public class StartupTests // is responsible for doing so prior to making relevant native calls; this tests entry points. // RemoteExecutor is used so that the individual method is used as early in the process as possible. - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void OSSupportsIPv4() { bool parentSupported = Socket.OSSupportsIPv4; @@ -25,7 +25,7 @@ public static void OSSupportsIPv4() }, parentSupported.ToString()).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void OSSupportsIPv6() { bool parentSupported = Socket.OSSupportsIPv6; @@ -35,7 +35,7 @@ public static void OSSupportsIPv6() }, parentSupported.ToString()).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void OSSupportsUnixDomainSockets() { bool parentSupported = Socket.OSSupportsUnixDomainSockets; @@ -46,7 +46,7 @@ public static void OSSupportsUnixDomainSockets() } #pragma warning disable CS0618 // SupportsIPv4 and SupportsIPv6 are obsolete - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void SupportsIPv4() { bool parentSupported = Socket.SupportsIPv4; @@ -56,7 +56,7 @@ public static void SupportsIPv4() }, parentSupported.ToString()).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void SupportsIPv6() { bool parentSupported = Socket.SupportsIPv6; @@ -67,7 +67,7 @@ public static void SupportsIPv6() } #pragma warning restore CS0618 - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void Ctor_SocketType_ProtocolType() { RemoteExecutor.Invoke(() => @@ -76,7 +76,7 @@ public static void Ctor_SocketType_ProtocolType() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void Ctor_AddressFamily_SocketType_ProtocolType() { RemoteExecutor.Invoke(() => @@ -85,7 +85,7 @@ public static void Ctor_AddressFamily_SocketType_ProtocolType() }).Dispose(); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void Ctor_SafeHandle() => RemoteExecutor.Invoke(() => { using var pipe = new AnonymousPipeServerStream(); diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 80383f69431680..0c8745a8f5dbf6 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -421,6 +421,9 @@ + + + @@ -463,17 +466,14 @@ + - - - - -