diff --git a/src/libraries/CodeAnalysis.ruleset b/src/libraries/CodeAnalysis.ruleset index 8384ea42d72..abb536c2506 100644 --- a/src/libraries/CodeAnalysis.ruleset +++ b/src/libraries/CodeAnalysis.ruleset @@ -38,4 +38,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs b/src/libraries/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs index 922454d3b96..1154cc147db 100644 --- a/src/libraries/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs +++ b/src/libraries/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs @@ -184,19 +184,18 @@ namespace System.Collections.Tests } } +#pragma warning disable xUnit1013 // xunit analyzer bug https://github.com/xunit/xunit/issues/1973 [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))] [MemberData(nameof(ValidCollectionSizes))] public virtual void ICollection_NonGeneric_CopyTo_NonZeroLowerBound(int count) { - if (!PlatformDetection.IsNonZeroLowerBoundArraySupported) - return; - ICollection collection = NonGenericICollectionFactory(count); Array arr = Array.CreateInstance(typeof(object), new int[1] { count }, new int[1] { 2 }); Assert.Equal(1, arr.Rank); Assert.Equal(2, arr.GetLowerBound(0)); Assert.Throws(ICollection_NonGeneric_CopyTo_NonZeroLowerBound_ThrowType, () => collection.CopyTo(arr, 0)); } +#pragma warning restore xUnit1013 [Theory] [MemberData(nameof(ValidCollectionSizes))] diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs index 12a88a4a98c..87dab8175ac 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs @@ -20,7 +20,7 @@ namespace System.Security.Cryptography.Rsa.Tests GenerateKey(rsa => GetSecondMin(rsa.LegalKeySizes)); } - // This test method takes approximately 1600 seconds to execute, so it is not on by default. + [Fact(Skip = "Takes approximately 1600 seconds to execute")] public static void GenerateMaxKey() { GenerateKey(rsa => GetMax(rsa.LegalKeySizes)); diff --git a/src/libraries/Common/tests/System/Xml/XPath/FuncLocation/PathAxeCombinationsTests.cs b/src/libraries/Common/tests/System/Xml/XPath/FuncLocation/PathAxeCombinationsTests.cs index a002c6763df..eb8b4d85775 100644 --- a/src/libraries/Common/tests/System/Xml/XPath/FuncLocation/PathAxeCombinationsTests.cs +++ b/src/libraries/Common/tests/System/Xml/XPath/FuncLocation/PathAxeCombinationsTests.cs @@ -44688,6 +44688,7 @@ namespace XPathTests.FunctionalTests.Location.Paths /// Combines namespace axis with following-sibling axis /// NS55: namespace::pre2/following-sibling::node() /// + [Fact] public static void AxesCombinationsTest2138() { var xml = "ns_prefixes.xml"; diff --git a/src/libraries/Common/tests/System/Xml/XPath/TestsWithEncoding/MiscWithEncodings.cs b/src/libraries/Common/tests/System/Xml/XPath/TestsWithEncoding/MiscWithEncodings.cs index c8f5d80b7eb..7ce20703f05 100644 --- a/src/libraries/Common/tests/System/Xml/XPath/TestsWithEncoding/MiscWithEncodings.cs +++ b/src/libraries/Common/tests/System/Xml/XPath/TestsWithEncoding/MiscWithEncodings.cs @@ -14,9 +14,9 @@ namespace XPathTests.FunctionalTests.Location.Paths /// /// Location Paths - MiscWithEncodings /// - public static partial class MiscWithEncodingTests + public class MiscWithEncodingTests { - public static void TestInitialize() + public MiscWithEncodingTests() { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); } @@ -26,10 +26,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// OrderIDs/CustomerIDs/EmployeeIDs/OrderDates/OrderDate[.="11/16/94"] /// [Fact] - public static void AbbreviatedSyntaxTest125() + public void AbbreviatedSyntaxTest125() { - TestInitialize(); - var xml = "XQL_Orders_j1.xml"; var testExpression = @"OrderIDs/CustomerIDs/EmployeeIDs/OrderDates/OrderDate[.='11/16/94']"; var expected = new XPathResult(0); @@ -41,10 +39,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// Russian: xpath testing problem char, return 1 node /// [Fact] - public static void GlobalizationTest5612() + public void GlobalizationTest5612() { - TestInitialize(); - var xml = "Russian_problem_chars.xml"; var testExpression = @"//root[contains(text(), ""?? ¤ ?? ?? © ? ® ??"")]"; var expected = new XPathResult(0, @@ -66,10 +62,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// OrderIDs/CustomerIDs[CustomerID]/EmployeeIDs[EmployeeID][OrderDates/Freight=12.75] /// [Fact] - public static void MatchesTest1136() + public void MatchesTest1136() { - TestInitialize(); - var xml = "XQL_Orders_j3.xml"; var startingNodePath = "//EmployeeIDs[1]"; var testExpression = @"OrderIDs/CustomerIDs[CustomerID]/EmployeeIDs[EmployeeID][OrderDates/Freight=12.75]"; @@ -83,10 +77,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// OrderIDs/CustomerIDs[9999999999999999999999999999999999999999999999999999999999999999999999999999999999999] /// [Fact] - public static void MatchesTest1137() + public void MatchesTest1137() { - TestInitialize(); - var xml = "XQL_Orders_j3.xml"; var startingNodePath = "//CustomerIDs"; var testExpression = @@ -101,10 +93,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// /ROOT/OrderIDs[OrderID/@CollatingOrder>=1033]/OrderID/@CollatingOrder /// [Fact] - public static void MatchesTest1138() + public void MatchesTest1138() { - TestInitialize(); - var xml = "xql_orders-flat-200a.xml"; var startingNodePath = "/ROOT/OrderIDs[22]/OrderID/@CollatingOrder"; var testExpression = @"/ROOT/OrderIDs[OrderID/@CollatingOrder>=1033]/OrderID/@CollatingOrder"; @@ -118,10 +108,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// .//OrderIDs[CustomerIDs[EmployeeIDs][//EmployeeID='3']][//OrderDate>='11/16/94'] /// [Fact] - public static void PredicatesTest1038() + public void PredicatesTest1038() { - TestInitialize(); - var xml = "XQL_Orders_j3.xml"; var startingNodePath = "/ROOT"; var testExpression = @".//OrderIDs[CustomerIDs[EmployeeIDs][//EmployeeID='3']][//OrderDate>='11/16/94']"; @@ -135,9 +123,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// OrderIDs/CustomerIDs[CustomerID]/EmployeeIDs[EmployeeID][OrderDates/Freight=12.75] /// [Fact] - public static void PredicatesTest1039() + public void PredicatesTest1039() { - TestInitialize(); var xml = "XQL_Orders_j3.xml"; var startingNodePath = "/ROOT"; var testExpression = @"OrderIDs/CustomerIDs[CustomerID]/EmployeeIDs[EmployeeID][OrderDates/Freight=12.75]"; @@ -161,9 +148,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// OrderIDs/CustomerIDs[9999999999999999999999999999999999999999999999999999999999999999999999999999999999999] /// [Fact] - public static void PredicatesTest1040() + public void PredicatesTest1040() { - TestInitialize(); var xml = "XQL_Orders_j1.xml"; var startingNodePath = "/ROOT"; var testExpression = @@ -178,9 +164,8 @@ namespace XPathTests.FunctionalTests.Location.Paths /// /ROOT/OrderIDs[OrderID/@CollatingOrder>=1033]/OrderID/@CollatingOrder /// [Fact] - public static void PredicatesTest1041() + public void PredicatesTest1041() { - TestInitialize(); var xml = "xql_orders-flat-200a.xml"; var testExpression = @"/ROOT/OrderIDs[OrderID/@CollatingOrder>=1033]/OrderID/@CollatingOrder"; var expected = new XPathResult(0, diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index e13cea88615..a09b26dca62 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -11,7 +11,6 @@ false $(MSBuildThisFileDirectory)CodeAnalysis.ruleset - true diff --git a/src/libraries/Microsoft.CSharp/tests/AssignmentTests.cs b/src/libraries/Microsoft.CSharp/tests/AssignmentTests.cs index 922ef78a8e4..d83e43d3505 100644 --- a/src/libraries/Microsoft.CSharp/tests/AssignmentTests.cs +++ b/src/libraries/Microsoft.CSharp/tests/AssignmentTests.cs @@ -155,8 +155,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(PropertyBadAssigments))] - public void PropertyIncompatibleConstantAssigment(object lhs, object rhs, bool _, bool invalidCast) + public void PropertyIncompatibleConstantAssigment(object lhs, object rhs, bool overflow, bool invalidCast) { + // Not used by this test + _ = overflow; + CallSite> callSite = CallSite>.Create( Binder.SetMember( @@ -204,8 +207,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(PropertyBadCheckedAssigments))] - public void PropertyIncompatibleConstantCheckedAssigment(object lhs, object rhs, bool _, bool invalidCast) + public void PropertyIncompatibleConstantCheckedAssigment(object lhs, object rhs, bool overflow, bool invalidCast) { + // Not used by this test + _ = overflow; + CallSite> callSite = CallSite>.Create( Binder.SetMember( diff --git a/src/libraries/Microsoft.CSharp/tests/BindingErrors.cs b/src/libraries/Microsoft.CSharp/tests/BindingErrors.cs index d1e91653cfc..363345d7cbc 100644 --- a/src/libraries/Microsoft.CSharp/tests/BindingErrors.cs +++ b/src/libraries/Microsoft.CSharp/tests/BindingErrors.cs @@ -416,7 +416,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests Assert.ThrowsAny(() => binder.Bind(args, parameters, target)); } - public static void DoStuff(IEnumerable x) + private static void DoStuff(IEnumerable x) { // Don't actually do stuff! } diff --git a/src/libraries/Microsoft.CSharp/tests/DynamicDebuggerProxyTests.cs b/src/libraries/Microsoft.CSharp/tests/DynamicDebuggerProxyTests.cs index 94359a9c129..a30e612b6e0 100644 --- a/src/libraries/Microsoft.CSharp/tests/DynamicDebuggerProxyTests.cs +++ b/src/libraries/Microsoft.CSharp/tests/DynamicDebuggerProxyTests.cs @@ -41,7 +41,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests public void TryGetMemberValue() { var obj = new DynamicTestObject(new Dictionary() { { "F", 1 } }); - Assert.Equal(1, TryGetMemberValue(obj, "F", ignoreException: false)); + Assert.Equal(1, TryGetMemberValueImpl(obj, "F", ignoreException: false)); } [Fact] @@ -50,11 +50,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests var obj = new DynamicTestObject(new Dictionary()); // ignoreException: true - Assert.Null(TryGetMemberValue(obj, "F", ignoreException: true)); + Assert.Null(TryGetMemberValueImpl(obj, "F", ignoreException: true)); // ignoreException: false var exceptionType = GetType("DynamicBindingFailedException"); - Assert.Throws(exceptionType, () => GetItems(TryGetMemberValue(obj, "F", ignoreException: false))); + Assert.Throws(exceptionType, () => GetItems(TryGetMemberValueImpl(obj, "F", ignoreException: false))); } [Fact] @@ -63,11 +63,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests var obj = new DynamicTestObject(new Dictionary(), throwIfMissing: true); // ignoreException: true - string message = (string)TryGetMemberValue(obj, "F", ignoreException: true); + string message = (string)TryGetMemberValueImpl(obj, "F", ignoreException: true); Assert.NotNull(message); // ignoreException: false - Assert.Throws(() => GetItems(TryGetMemberValue(obj, "F", ignoreException: false))); + Assert.Throws(() => GetItems(TryGetMemberValueImpl(obj, "F", ignoreException: false))); } private static Type GetType(string typeName) @@ -86,7 +86,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests return (object[])InvokeAndUnwrapException(method, debugView, new object[0]); } - private static object TryGetMemberValue(object obj, string name, bool ignoreException) + private static object TryGetMemberValueImpl(object obj, string name, bool ignoreException) { var method = _debugViewType.GetMethod("TryGetMemberValue", BindingFlags.NonPublic | BindingFlags.Static); return InvokeAndUnwrapException(method, null, new object[] { obj, name, ignoreException }); diff --git a/src/libraries/Microsoft.CSharp/tests/EnumArithmeticTests.cs b/src/libraries/Microsoft.CSharp/tests/EnumArithmeticTests.cs index 30fafec3481..3f1bc0e746a 100644 --- a/src/libraries/Microsoft.CSharp/tests/EnumArithmeticTests.cs +++ b/src/libraries/Microsoft.CSharp/tests/EnumArithmeticTests.cs @@ -240,7 +240,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests [Theory, MemberData(nameof(ByteEnumAdditions))] [ActiveIssue(31032, TargetFrameworkMonikers.NetFramework)] - public void LiftedEnumAddition(ByteEnum? enumVal, byte? integralVal, ByteEnum expected) + public void LiftedEnumAdditionByte(ByteEnum? enumVal, byte? integralVal, ByteEnum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -260,7 +260,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests [Theory, MemberData(nameof(SByteEnumAdditions))] [ActiveIssue(31032, TargetFrameworkMonikers.NetFramework)] - public void LiftedEnumAddition(SByteEnum? enumVal, sbyte? integralVal, SByteEnum expected) + public void LiftedEnumAdditionSByte(SByteEnum? enumVal, sbyte? integralVal, SByteEnum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -279,7 +279,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int16EnumAdditions))] - public void LiftedEnumAddition(Int16Enum? enumVal, short? integralVal, Int16Enum expected) + public void LiftedEnumAdditionInt16(Int16Enum? enumVal, short? integralVal, Int16Enum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -298,7 +298,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt16EnumAdditions))] - public void LiftedEnumAddition(UInt16Enum? enumVal, ushort? integralVal, UInt16Enum expected) + public void LiftedEnumAdditionUInt16(UInt16Enum? enumVal, ushort? integralVal, UInt16Enum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -317,7 +317,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int32EnumAdditions))] - public void LiftedEnumAddition(Int32Enum? enumVal, int? integralVal, Int32Enum expected) + public void LiftedEnumAdditionInt32(Int32Enum? enumVal, int? integralVal, Int32Enum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -336,7 +336,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt32EnumAdditions))] - public void LiftedEnumAddition(UInt32Enum? enumVal, uint? integralVal, UInt32Enum expected) + public void LiftedEnumAdditionUInt32(UInt32Enum? enumVal, uint? integralVal, UInt32Enum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -355,7 +355,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int64EnumAdditions))] - public void LiftedEnumAddition(Int64Enum? enumVal, long? integralVal, Int64Enum expected) + public void LiftedEnumAdditionInt64(Int64Enum? enumVal, long? integralVal, Int64Enum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -374,7 +374,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt64EnumAdditions))] - public void LiftedEnumAddition(UInt64Enum? enumVal, ulong? integralVal, UInt64Enum expected) + public void LiftedEnumAdditionUInt64(UInt64Enum? enumVal, ulong? integralVal, UInt64Enum expected) { dynamic d = enumVal; object result = unchecked(d + integralVal); @@ -461,7 +461,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests [Theory, MemberData(nameof(SByteEnumSubtractions))] [ActiveIssue(31032, TargetFrameworkMonikers.NetFramework)] - public void LiftedEnumSubtraction(SByteEnum? enumVal, sbyte? integralVal, SByteEnum? enMinusIn, SByteEnum? inMinusEn) + public void LiftedEnumSubtractionSByte(SByteEnum? enumVal, sbyte? integralVal, SByteEnum? enMinusIn, SByteEnum? inMinusEn) { dynamic d = enumVal; object result = unchecked(d - integralVal); @@ -480,7 +480,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int16EnumSubtractions))] - public void LiftedEnumSubtraction(Int16Enum? enumVal, short? integralVal, Int16Enum? enMinusIn, Int16Enum? inMinusEn) + public void LiftedEnumSubtractionInt16(Int16Enum? enumVal, short? integralVal, Int16Enum? enMinusIn, Int16Enum? inMinusEn) { dynamic d = enumVal; object result = unchecked(d - integralVal); @@ -499,7 +499,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt16EnumSubtractions))] - public void LiftedEnumSubtraction(UInt16Enum? enumVal, ushort? integralVal, UInt16Enum? enMinusIn, UInt16Enum? inMinusEn) + public void LiftedEnumSubtractionUInt16(UInt16Enum? enumVal, ushort? integralVal, UInt16Enum? enMinusIn, UInt16Enum? inMinusEn) { dynamic d = enumVal; object result = unchecked(d - integralVal); @@ -518,7 +518,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int32EnumSubtractions))] - public void LiftedEnumSubtraction(Int32Enum? enumVal, int? integralVal, Int32Enum? enMinusIn, Int32Enum? inMinusEn) + public void LiftedEnumSubtractionInt32(Int32Enum? enumVal, int? integralVal, Int32Enum? enMinusIn, Int32Enum? inMinusEn) { dynamic d = enumVal; object result = unchecked(d - integralVal); @@ -537,7 +537,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt32EnumSubtractions))] - public void LiftedEnumSubtraction(UInt32Enum? enumVal, uint? integralVal, UInt32Enum? enMinusIn, UInt32Enum? inMinusEn) + public void LiftedEnumSubtractionUInt32(UInt32Enum? enumVal, uint? integralVal, UInt32Enum? enMinusIn, UInt32Enum? inMinusEn) { dynamic d = enumVal; object result = unchecked(d - integralVal); @@ -556,7 +556,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int64EnumSubtractions))] - public void LiftedEnumSubtraction(Int64Enum? enumVal, long? integralVal, Int64Enum? enMinusIn, Int64Enum? inMinusEn) + public void LiftedEnumSubtractionInt64(Int64Enum? enumVal, long? integralVal, Int64Enum? enMinusIn, Int64Enum? inMinusEn) { dynamic d = enumVal; object result = unchecked(d - integralVal); @@ -575,7 +575,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt64EnumSubtractions))] - public void LiftedEnumSubtraction(UInt64Enum? enumVal, ulong? integralVal, UInt64Enum? enMinusIn, UInt64Enum? inMinusEn) + public void LiftedEnumSubtractionUInt64(UInt64Enum? enumVal, ulong? integralVal, UInt64Enum? enMinusIn, UInt64Enum? inMinusEn) { dynamic d = enumVal; object result = unchecked(d - integralVal); @@ -595,7 +595,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests [Theory, MemberData(nameof(ByteEnumSelfSubtraction))] [ActiveIssue(31032, TargetFrameworkMonikers.NetFramework)] - public void EnumSubtraction(ByteEnum? x, ByteEnum? y, byte expected, bool overflows) + public void EnumSubtractionByte(ByteEnum? x, ByteEnum? y, byte expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); @@ -615,7 +615,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests [Theory, MemberData(nameof(SByteEnumSelfSubtraction))] [ActiveIssue(31032, TargetFrameworkMonikers.NetFramework)] - public void EnumSubtraction(SByteEnum? x, SByteEnum? y, sbyte expected, bool overflows) + public void EnumSubtractionSByte(SByteEnum? x, SByteEnum? y, sbyte expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); @@ -634,7 +634,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int16EnumSelfSubtraction))] - public void EnumSubtraction(Int16Enum? x, Int16Enum? y, short expected, bool overflows) + public void EnumSubtractionInt16(Int16Enum? x, Int16Enum? y, short expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); @@ -653,7 +653,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt16EnumSelfSubtraction))] - public void EnumSubtraction(UInt16Enum? x, UInt16Enum? y, ushort expected, bool overflows) + public void EnumSubtractionUInt16(UInt16Enum? x, UInt16Enum? y, ushort expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); @@ -672,7 +672,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int32EnumSelfSubtraction))] - public void EnumSubtraction(Int32Enum? x, Int32Enum? y, int expected, bool overflows) + public void EnumSubtractionInt32(Int32Enum? x, Int32Enum? y, int expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); @@ -691,7 +691,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt32EnumSelfSubtraction))] - public void EnumSubtraction(UInt32Enum? x, UInt32Enum? y, uint expected, bool overflows) + public void EnumSubtractionUInt32(UInt32Enum? x, UInt32Enum? y, uint expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); @@ -710,7 +710,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(Int64EnumSelfSubtraction))] - public void EnumSubtraction(Int64Enum? x, Int64Enum? y, long expected, bool overflows) + public void EnumSubtractionInt64(Int64Enum? x, Int64Enum? y, long expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); @@ -729,7 +729,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Tests } [Theory, MemberData(nameof(UInt64EnumSelfSubtraction))] - public void EnumSubtraction(UInt64Enum? x, UInt64Enum? y, ulong expected, bool overflows) + public void EnumSubtractionUInt64(UInt64Enum? x, UInt64Enum? y, ulong expected, bool overflows) { dynamic d = x; object result = unchecked(d - y); diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentCollectionTests.cs index fe092d361a5..fc7f561fcf3 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeAttributeArgumentCollectionTests : CodeCollectionTestBase { - public override CodeAttributeArgumentCollection Ctor() => new CodeAttributeArgumentCollection(); - public override CodeAttributeArgumentCollection CtorArray(CodeAttributeArgument[] array) => new CodeAttributeArgumentCollection(array); - public override CodeAttributeArgumentCollection CtorCollection(CodeAttributeArgumentCollection collection) => new CodeAttributeArgumentCollection(collection); + protected override CodeAttributeArgumentCollection Ctor() => new CodeAttributeArgumentCollection(); + protected override CodeAttributeArgumentCollection CtorArray(CodeAttributeArgument[] array) => new CodeAttributeArgumentCollection(array); + protected override CodeAttributeArgumentCollection CtorCollection(CodeAttributeArgumentCollection collection) => new CodeAttributeArgumentCollection(collection); - public override int Count(CodeAttributeArgumentCollection collection) => collection.Count; + protected override int Count(CodeAttributeArgumentCollection collection) => collection.Count; - public override CodeAttributeArgument GetItem(CodeAttributeArgumentCollection collection, int index) => collection[index]; - public override void SetItem(CodeAttributeArgumentCollection collection, int index, CodeAttributeArgument value) => collection[index] = value; + protected override CodeAttributeArgument GetItem(CodeAttributeArgumentCollection collection, int index) => collection[index]; + protected override void SetItem(CodeAttributeArgumentCollection collection, int index, CodeAttributeArgument value) => collection[index] = value; - public override void AddRange(CodeAttributeArgumentCollection collection, CodeAttributeArgument[] array) => collection.AddRange(array); - public override void AddRange(CodeAttributeArgumentCollection collection, CodeAttributeArgumentCollection value) => collection.AddRange(value); + protected override void AddRange(CodeAttributeArgumentCollection collection, CodeAttributeArgument[] array) => collection.AddRange(array); + protected override void AddRange(CodeAttributeArgumentCollection collection, CodeAttributeArgumentCollection value) => collection.AddRange(value); - public override object Add(CodeAttributeArgumentCollection collection, CodeAttributeArgument obj) => collection.Add(obj); + protected override object Add(CodeAttributeArgumentCollection collection, CodeAttributeArgument obj) => collection.Add(obj); - public override void Insert(CodeAttributeArgumentCollection collection, int index, CodeAttributeArgument value) => collection.Insert(index, value); + protected override void Insert(CodeAttributeArgumentCollection collection, int index, CodeAttributeArgument value) => collection.Insert(index, value); - public override void Remove(CodeAttributeArgumentCollection collection, CodeAttributeArgument value) => collection.Remove(value); + protected override void Remove(CodeAttributeArgumentCollection collection, CodeAttributeArgument value) => collection.Remove(value); - public override int IndexOf(CodeAttributeArgumentCollection collection, CodeAttributeArgument value) => collection.IndexOf(value); - public override bool Contains(CodeAttributeArgumentCollection collection, CodeAttributeArgument value) => collection.Contains(value); + protected override int IndexOf(CodeAttributeArgumentCollection collection, CodeAttributeArgument value) => collection.IndexOf(value); + protected override bool Contains(CodeAttributeArgumentCollection collection, CodeAttributeArgument value) => collection.Contains(value); - public override void CopyTo(CodeAttributeArgumentCollection collection, CodeAttributeArgument[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeAttributeArgumentCollection collection, CodeAttributeArgument[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationCollectionTests.cs index 4e5e0f973fb..79964f5165f 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeAttributeDeclarationCollectionTests : CodeCollectionTestBase { - public override CodeAttributeDeclarationCollection Ctor() => new CodeAttributeDeclarationCollection(); - public override CodeAttributeDeclarationCollection CtorArray(CodeAttributeDeclaration[] array) => new CodeAttributeDeclarationCollection(array); - public override CodeAttributeDeclarationCollection CtorCollection(CodeAttributeDeclarationCollection collection) => new CodeAttributeDeclarationCollection(collection); + protected override CodeAttributeDeclarationCollection Ctor() => new CodeAttributeDeclarationCollection(); + protected override CodeAttributeDeclarationCollection CtorArray(CodeAttributeDeclaration[] array) => new CodeAttributeDeclarationCollection(array); + protected override CodeAttributeDeclarationCollection CtorCollection(CodeAttributeDeclarationCollection collection) => new CodeAttributeDeclarationCollection(collection); - public override int Count(CodeAttributeDeclarationCollection collection) => collection.Count; + protected override int Count(CodeAttributeDeclarationCollection collection) => collection.Count; - public override CodeAttributeDeclaration GetItem(CodeAttributeDeclarationCollection collection, int index) => collection[index]; - public override void SetItem(CodeAttributeDeclarationCollection collection, int index, CodeAttributeDeclaration value) => collection[index] = value; + protected override CodeAttributeDeclaration GetItem(CodeAttributeDeclarationCollection collection, int index) => collection[index]; + protected override void SetItem(CodeAttributeDeclarationCollection collection, int index, CodeAttributeDeclaration value) => collection[index] = value; - public override void AddRange(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration[] array) => collection.AddRange(array); - public override void AddRange(CodeAttributeDeclarationCollection collection, CodeAttributeDeclarationCollection value) => collection.AddRange(value); + protected override void AddRange(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration[] array) => collection.AddRange(array); + protected override void AddRange(CodeAttributeDeclarationCollection collection, CodeAttributeDeclarationCollection value) => collection.AddRange(value); - public override object Add(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration obj) => collection.Add(obj); + protected override object Add(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration obj) => collection.Add(obj); - public override void Insert(CodeAttributeDeclarationCollection collection, int index, CodeAttributeDeclaration value) => collection.Insert(index, value); + protected override void Insert(CodeAttributeDeclarationCollection collection, int index, CodeAttributeDeclaration value) => collection.Insert(index, value); - public override void Remove(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration value) => collection.Remove(value); + protected override void Remove(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration value) => collection.Remove(value); - public override int IndexOf(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration value) => collection.IndexOf(value); - public override bool Contains(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration value) => collection.Contains(value); + protected override int IndexOf(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration value) => collection.IndexOf(value); + protected override bool Contains(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration value) => collection.Contains(value); - public override void CopyTo(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeAttributeDeclarationCollection collection, CodeAttributeDeclaration[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCatchClauseCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCatchClauseCollectionTests.cs index 9130f6c2437..3fd5063b64c 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCatchClauseCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCatchClauseCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeCatchClauseCollectionTests : CodeCollectionTestBase { - public override CodeCatchClauseCollection Ctor() => new CodeCatchClauseCollection(); - public override CodeCatchClauseCollection CtorArray(CodeCatchClause[] array) => new CodeCatchClauseCollection(array); - public override CodeCatchClauseCollection CtorCollection(CodeCatchClauseCollection collection) => new CodeCatchClauseCollection(collection); + protected override CodeCatchClauseCollection Ctor() => new CodeCatchClauseCollection(); + protected override CodeCatchClauseCollection CtorArray(CodeCatchClause[] array) => new CodeCatchClauseCollection(array); + protected override CodeCatchClauseCollection CtorCollection(CodeCatchClauseCollection collection) => new CodeCatchClauseCollection(collection); - public override int Count(CodeCatchClauseCollection collection) => collection.Count; + protected override int Count(CodeCatchClauseCollection collection) => collection.Count; - public override CodeCatchClause GetItem(CodeCatchClauseCollection collection, int index) => collection[index]; - public override void SetItem(CodeCatchClauseCollection collection, int index, CodeCatchClause value) => collection[index] = value; + protected override CodeCatchClause GetItem(CodeCatchClauseCollection collection, int index) => collection[index]; + protected override void SetItem(CodeCatchClauseCollection collection, int index, CodeCatchClause value) => collection[index] = value; - public override void AddRange(CodeCatchClauseCollection collection, CodeCatchClause[] array) => collection.AddRange(array); - public override void AddRange(CodeCatchClauseCollection collection, CodeCatchClauseCollection value) => collection.AddRange(value); + protected override void AddRange(CodeCatchClauseCollection collection, CodeCatchClause[] array) => collection.AddRange(array); + protected override void AddRange(CodeCatchClauseCollection collection, CodeCatchClauseCollection value) => collection.AddRange(value); - public override object Add(CodeCatchClauseCollection collection, CodeCatchClause obj) => collection.Add(obj); + protected override object Add(CodeCatchClauseCollection collection, CodeCatchClause obj) => collection.Add(obj); - public override void Insert(CodeCatchClauseCollection collection, int index, CodeCatchClause value) => collection.Insert(index, value); + protected override void Insert(CodeCatchClauseCollection collection, int index, CodeCatchClause value) => collection.Insert(index, value); - public override void Remove(CodeCatchClauseCollection collection, CodeCatchClause value) => collection.Remove(value); + protected override void Remove(CodeCatchClauseCollection collection, CodeCatchClause value) => collection.Remove(value); - public override int IndexOf(CodeCatchClauseCollection collection, CodeCatchClause value) => collection.IndexOf(value); - public override bool Contains(CodeCatchClauseCollection collection, CodeCatchClause value) => collection.Contains(value); + protected override int IndexOf(CodeCatchClauseCollection collection, CodeCatchClause value) => collection.IndexOf(value); + protected override bool Contains(CodeCatchClauseCollection collection, CodeCatchClause value) => collection.Contains(value); - public override void CopyTo(CodeCatchClauseCollection collection, CodeCatchClause[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeCatchClauseCollection collection, CodeCatchClause[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCollectionTestBase.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCollectionTestBase.cs index c2866d7b3f9..f4893733b70 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCollectionTestBase.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCollectionTestBase.cs @@ -9,27 +9,27 @@ namespace System.CodeDom.Tests { public abstract class CodeCollectionTestBase where TCollection: class where TItem : class, new() { - public abstract TCollection Ctor(); - public abstract TCollection CtorArray(TItem[] array); - public abstract TCollection CtorCollection(TCollection collection); + protected abstract TCollection Ctor(); + protected abstract TCollection CtorArray(TItem[] array); + protected abstract TCollection CtorCollection(TCollection collection); - public abstract int Count(TCollection collection); + protected abstract int Count(TCollection collection); - public abstract TItem GetItem(TCollection collection, int index); - public abstract void SetItem(TCollection collection, int index, TItem value); + protected abstract TItem GetItem(TCollection collection, int index); + protected abstract void SetItem(TCollection collection, int index, TItem value); - public abstract void AddRange(TCollection collection, TItem[] array); - public abstract void AddRange(TCollection collection, TCollection value); + protected abstract void AddRange(TCollection collection, TItem[] array); + protected abstract void AddRange(TCollection collection, TCollection value); - public abstract object Add(TCollection collection, TItem seed); + protected abstract object Add(TCollection collection, TItem seed); - public abstract void Insert(TCollection collection, int index, TItem value); - public abstract void Remove(TCollection collection, TItem value); + protected abstract void Insert(TCollection collection, int index, TItem value); + protected abstract void Remove(TCollection collection, TItem value); - public abstract int IndexOf(TCollection collection, TItem value); - public abstract bool Contains(TCollection collection, TItem value); + protected abstract int IndexOf(TCollection collection, TItem value); + protected abstract bool Contains(TCollection collection, TItem value); - public abstract void CopyTo(TCollection collection, TItem[] array, int index); + protected abstract void CopyTo(TCollection collection, TItem[] array, int index); [Fact] public void Ctor_Empty() diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCommentStatementCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCommentStatementCollectionTests.cs index 84cc8fb41ae..a6b53b2025f 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCommentStatementCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeCommentStatementCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeCommentStatementCollectionTests : CodeCollectionTestBase { - public override CodeCommentStatementCollection Ctor() => new CodeCommentStatementCollection(); - public override CodeCommentStatementCollection CtorArray(CodeCommentStatement[] array) => new CodeCommentStatementCollection(array); - public override CodeCommentStatementCollection CtorCollection(CodeCommentStatementCollection collection) => new CodeCommentStatementCollection(collection); + protected override CodeCommentStatementCollection Ctor() => new CodeCommentStatementCollection(); + protected override CodeCommentStatementCollection CtorArray(CodeCommentStatement[] array) => new CodeCommentStatementCollection(array); + protected override CodeCommentStatementCollection CtorCollection(CodeCommentStatementCollection collection) => new CodeCommentStatementCollection(collection); - public override int Count(CodeCommentStatementCollection collection) => collection.Count; + protected override int Count(CodeCommentStatementCollection collection) => collection.Count; - public override CodeCommentStatement GetItem(CodeCommentStatementCollection collection, int index) => collection[index]; - public override void SetItem(CodeCommentStatementCollection collection, int index, CodeCommentStatement value) => collection[index] = value; + protected override CodeCommentStatement GetItem(CodeCommentStatementCollection collection, int index) => collection[index]; + protected override void SetItem(CodeCommentStatementCollection collection, int index, CodeCommentStatement value) => collection[index] = value; - public override void AddRange(CodeCommentStatementCollection collection, CodeCommentStatement[] array) => collection.AddRange(array); - public override void AddRange(CodeCommentStatementCollection collection, CodeCommentStatementCollection value) => collection.AddRange(value); + protected override void AddRange(CodeCommentStatementCollection collection, CodeCommentStatement[] array) => collection.AddRange(array); + protected override void AddRange(CodeCommentStatementCollection collection, CodeCommentStatementCollection value) => collection.AddRange(value); - public override object Add(CodeCommentStatementCollection collection, CodeCommentStatement obj) => collection.Add(obj); + protected override object Add(CodeCommentStatementCollection collection, CodeCommentStatement obj) => collection.Add(obj); - public override void Insert(CodeCommentStatementCollection collection, int index, CodeCommentStatement value) => collection.Insert(index, value); + protected override void Insert(CodeCommentStatementCollection collection, int index, CodeCommentStatement value) => collection.Insert(index, value); - public override void Remove(CodeCommentStatementCollection collection, CodeCommentStatement value) => collection.Remove(value); + protected override void Remove(CodeCommentStatementCollection collection, CodeCommentStatement value) => collection.Remove(value); - public override int IndexOf(CodeCommentStatementCollection collection, CodeCommentStatement value) => collection.IndexOf(value); - public override bool Contains(CodeCommentStatementCollection collection, CodeCommentStatement value) => collection.Contains(value); + protected override int IndexOf(CodeCommentStatementCollection collection, CodeCommentStatement value) => collection.IndexOf(value); + protected override bool Contains(CodeCommentStatementCollection collection, CodeCommentStatement value) => collection.Contains(value); - public override void CopyTo(CodeCommentStatementCollection collection, CodeCommentStatement[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeCommentStatementCollection collection, CodeCommentStatement[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDirectiveCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDirectiveCollectionTests.cs index 44b52f1d042..d36152786ee 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDirectiveCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDirectiveCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeDirectiveCollectionTests : CodeCollectionTestBase { - public override CodeDirectiveCollection Ctor() => new CodeDirectiveCollection(); - public override CodeDirectiveCollection CtorArray(CodeDirective[] array) => new CodeDirectiveCollection(array); - public override CodeDirectiveCollection CtorCollection(CodeDirectiveCollection collection) => new CodeDirectiveCollection(collection); + protected override CodeDirectiveCollection Ctor() => new CodeDirectiveCollection(); + protected override CodeDirectiveCollection CtorArray(CodeDirective[] array) => new CodeDirectiveCollection(array); + protected override CodeDirectiveCollection CtorCollection(CodeDirectiveCollection collection) => new CodeDirectiveCollection(collection); - public override int Count(CodeDirectiveCollection collection) => collection.Count; + protected override int Count(CodeDirectiveCollection collection) => collection.Count; - public override CodeDirective GetItem(CodeDirectiveCollection collection, int index) => collection[index]; - public override void SetItem(CodeDirectiveCollection collection, int index, CodeDirective value) => collection[index] = value; + protected override CodeDirective GetItem(CodeDirectiveCollection collection, int index) => collection[index]; + protected override void SetItem(CodeDirectiveCollection collection, int index, CodeDirective value) => collection[index] = value; - public override void AddRange(CodeDirectiveCollection collection, CodeDirective[] array) => collection.AddRange(array); - public override void AddRange(CodeDirectiveCollection collection, CodeDirectiveCollection value) => collection.AddRange(value); + protected override void AddRange(CodeDirectiveCollection collection, CodeDirective[] array) => collection.AddRange(array); + protected override void AddRange(CodeDirectiveCollection collection, CodeDirectiveCollection value) => collection.AddRange(value); - public override object Add(CodeDirectiveCollection collection, CodeDirective obj) => collection.Add(obj); + protected override object Add(CodeDirectiveCollection collection, CodeDirective obj) => collection.Add(obj); - public override void Insert(CodeDirectiveCollection collection, int index, CodeDirective value) => collection.Insert(index, value); + protected override void Insert(CodeDirectiveCollection collection, int index, CodeDirective value) => collection.Insert(index, value); - public override void Remove(CodeDirectiveCollection collection, CodeDirective value) => collection.Remove(value); + protected override void Remove(CodeDirectiveCollection collection, CodeDirective value) => collection.Remove(value); - public override int IndexOf(CodeDirectiveCollection collection, CodeDirective value) => collection.IndexOf(value); - public override bool Contains(CodeDirectiveCollection collection, CodeDirective value) => collection.Contains(value); + protected override int IndexOf(CodeDirectiveCollection collection, CodeDirective value) => collection.IndexOf(value); + protected override bool Contains(CodeDirectiveCollection collection, CodeDirective value) => collection.Contains(value); - public override void CopyTo(CodeDirectiveCollection collection, CodeDirective[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeDirectiveCollection collection, CodeDirective[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeExpressionCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeExpressionCollectionTests.cs index b386d309d8b..97d8cf8f4ab 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeExpressionCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeExpressionCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeExpressionCollectionTests : CodeCollectionTestBase { - public override CodeExpressionCollection Ctor() => new CodeExpressionCollection(); - public override CodeExpressionCollection CtorArray(CodeExpression[] array) => new CodeExpressionCollection(array); - public override CodeExpressionCollection CtorCollection(CodeExpressionCollection collection) => new CodeExpressionCollection(collection); + protected override CodeExpressionCollection Ctor() => new CodeExpressionCollection(); + protected override CodeExpressionCollection CtorArray(CodeExpression[] array) => new CodeExpressionCollection(array); + protected override CodeExpressionCollection CtorCollection(CodeExpressionCollection collection) => new CodeExpressionCollection(collection); - public override int Count(CodeExpressionCollection collection) => collection.Count; + protected override int Count(CodeExpressionCollection collection) => collection.Count; - public override CodeExpression GetItem(CodeExpressionCollection collection, int index) => collection[index]; - public override void SetItem(CodeExpressionCollection collection, int index, CodeExpression value) => collection[index] = value; + protected override CodeExpression GetItem(CodeExpressionCollection collection, int index) => collection[index]; + protected override void SetItem(CodeExpressionCollection collection, int index, CodeExpression value) => collection[index] = value; - public override void AddRange(CodeExpressionCollection collection, CodeExpression[] array) => collection.AddRange(array); - public override void AddRange(CodeExpressionCollection collection, CodeExpressionCollection value) => collection.AddRange(value); + protected override void AddRange(CodeExpressionCollection collection, CodeExpression[] array) => collection.AddRange(array); + protected override void AddRange(CodeExpressionCollection collection, CodeExpressionCollection value) => collection.AddRange(value); - public override object Add(CodeExpressionCollection collection, CodeExpression obj) => collection.Add(obj); + protected override object Add(CodeExpressionCollection collection, CodeExpression obj) => collection.Add(obj); - public override void Insert(CodeExpressionCollection collection, int index, CodeExpression value) => collection.Insert(index, value); + protected override void Insert(CodeExpressionCollection collection, int index, CodeExpression value) => collection.Insert(index, value); - public override void Remove(CodeExpressionCollection collection, CodeExpression value) => collection.Remove(value); + protected override void Remove(CodeExpressionCollection collection, CodeExpression value) => collection.Remove(value); - public override int IndexOf(CodeExpressionCollection collection, CodeExpression value) => collection.IndexOf(value); - public override bool Contains(CodeExpressionCollection collection, CodeExpression value) => collection.Contains(value); + protected override int IndexOf(CodeExpressionCollection collection, CodeExpression value) => collection.IndexOf(value); + protected override bool Contains(CodeExpressionCollection collection, CodeExpression value) => collection.Contains(value); - public override void CopyTo(CodeExpressionCollection collection, CodeExpression[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeExpressionCollection collection, CodeExpression[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeNamespaceCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeNamespaceCollectionTests.cs index 25fe39eba25..21f3a763f07 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeNamespaceCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeNamespaceCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeNamespaceCollectionTests : CodeCollectionTestBase { - public override CodeNamespaceCollection Ctor() => new CodeNamespaceCollection(); - public override CodeNamespaceCollection CtorArray(CodeNamespace[] array) => new CodeNamespaceCollection(array); - public override CodeNamespaceCollection CtorCollection(CodeNamespaceCollection collection) => new CodeNamespaceCollection(collection); + protected override CodeNamespaceCollection Ctor() => new CodeNamespaceCollection(); + protected override CodeNamespaceCollection CtorArray(CodeNamespace[] array) => new CodeNamespaceCollection(array); + protected override CodeNamespaceCollection CtorCollection(CodeNamespaceCollection collection) => new CodeNamespaceCollection(collection); - public override int Count(CodeNamespaceCollection collection) => collection.Count; + protected override int Count(CodeNamespaceCollection collection) => collection.Count; - public override CodeNamespace GetItem(CodeNamespaceCollection collection, int index) => collection[index]; - public override void SetItem(CodeNamespaceCollection collection, int index, CodeNamespace value) => collection[index] = value; + protected override CodeNamespace GetItem(CodeNamespaceCollection collection, int index) => collection[index]; + protected override void SetItem(CodeNamespaceCollection collection, int index, CodeNamespace value) => collection[index] = value; - public override void AddRange(CodeNamespaceCollection collection, CodeNamespace[] array) => collection.AddRange(array); - public override void AddRange(CodeNamespaceCollection collection, CodeNamespaceCollection value) => collection.AddRange(value); + protected override void AddRange(CodeNamespaceCollection collection, CodeNamespace[] array) => collection.AddRange(array); + protected override void AddRange(CodeNamespaceCollection collection, CodeNamespaceCollection value) => collection.AddRange(value); - public override object Add(CodeNamespaceCollection collection, CodeNamespace obj) => collection.Add(obj); + protected override object Add(CodeNamespaceCollection collection, CodeNamespace obj) => collection.Add(obj); - public override void Insert(CodeNamespaceCollection collection, int index, CodeNamespace value) => collection.Insert(index, value); + protected override void Insert(CodeNamespaceCollection collection, int index, CodeNamespace value) => collection.Insert(index, value); - public override void Remove(CodeNamespaceCollection collection, CodeNamespace value) => collection.Remove(value); + protected override void Remove(CodeNamespaceCollection collection, CodeNamespace value) => collection.Remove(value); - public override int IndexOf(CodeNamespaceCollection collection, CodeNamespace value) => collection.IndexOf(value); - public override bool Contains(CodeNamespaceCollection collection, CodeNamespace value) => collection.Contains(value); + protected override int IndexOf(CodeNamespaceCollection collection, CodeNamespace value) => collection.IndexOf(value); + protected override bool Contains(CodeNamespaceCollection collection, CodeNamespace value) => collection.Contains(value); - public override void CopyTo(CodeNamespaceCollection collection, CodeNamespace[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeNamespaceCollection collection, CodeNamespace[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeParameterDeclarationExpressionCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeParameterDeclarationExpressionCollectionTests.cs index b27ce22e09e..9a6db5bef23 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeParameterDeclarationExpressionCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeParameterDeclarationExpressionCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeParameterDeclarationExpressionCollectionTests : CodeCollectionTestBase { - public override CodeParameterDeclarationExpressionCollection Ctor() => new CodeParameterDeclarationExpressionCollection(); - public override CodeParameterDeclarationExpressionCollection CtorArray(CodeParameterDeclarationExpression[] array) => new CodeParameterDeclarationExpressionCollection(array); - public override CodeParameterDeclarationExpressionCollection CtorCollection(CodeParameterDeclarationExpressionCollection collection) => new CodeParameterDeclarationExpressionCollection(collection); + protected override CodeParameterDeclarationExpressionCollection Ctor() => new CodeParameterDeclarationExpressionCollection(); + protected override CodeParameterDeclarationExpressionCollection CtorArray(CodeParameterDeclarationExpression[] array) => new CodeParameterDeclarationExpressionCollection(array); + protected override CodeParameterDeclarationExpressionCollection CtorCollection(CodeParameterDeclarationExpressionCollection collection) => new CodeParameterDeclarationExpressionCollection(collection); - public override int Count(CodeParameterDeclarationExpressionCollection collection) => collection.Count; + protected override int Count(CodeParameterDeclarationExpressionCollection collection) => collection.Count; - public override CodeParameterDeclarationExpression GetItem(CodeParameterDeclarationExpressionCollection collection, int index) => collection[index]; - public override void SetItem(CodeParameterDeclarationExpressionCollection collection, int index, CodeParameterDeclarationExpression value) => collection[index] = value; + protected override CodeParameterDeclarationExpression GetItem(CodeParameterDeclarationExpressionCollection collection, int index) => collection[index]; + protected override void SetItem(CodeParameterDeclarationExpressionCollection collection, int index, CodeParameterDeclarationExpression value) => collection[index] = value; - public override void AddRange(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression[] array) => collection.AddRange(array); - public override void AddRange(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpressionCollection value) => collection.AddRange(value); + protected override void AddRange(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression[] array) => collection.AddRange(array); + protected override void AddRange(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpressionCollection value) => collection.AddRange(value); - public override object Add(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression obj) => collection.Add(obj); + protected override object Add(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression obj) => collection.Add(obj); - public override void Insert(CodeParameterDeclarationExpressionCollection collection, int index, CodeParameterDeclarationExpression value) => collection.Insert(index, value); + protected override void Insert(CodeParameterDeclarationExpressionCollection collection, int index, CodeParameterDeclarationExpression value) => collection.Insert(index, value); - public override void Remove(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression value) => collection.Remove(value); + protected override void Remove(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression value) => collection.Remove(value); - public override int IndexOf(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression value) => collection.IndexOf(value); - public override bool Contains(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression value) => collection.Contains(value); + protected override int IndexOf(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression value) => collection.IndexOf(value); + protected override bool Contains(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression value) => collection.Contains(value); - public override void CopyTo(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeParameterDeclarationExpressionCollection collection, CodeParameterDeclarationExpression[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeStatementCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeStatementCollectionTests.cs index ab02c770a58..79da3af308d 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeStatementCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeStatementCollectionTests.cs @@ -9,28 +9,28 @@ namespace System.CodeDom.Tests { public class CodeStatementCollectionTests : CodeCollectionTestBase { - public override CodeStatementCollection Ctor() => new CodeStatementCollection(); - public override CodeStatementCollection CtorArray(CodeStatement[] array) => new CodeStatementCollection(array); - public override CodeStatementCollection CtorCollection(CodeStatementCollection collection) => new CodeStatementCollection(collection); + protected override CodeStatementCollection Ctor() => new CodeStatementCollection(); + protected override CodeStatementCollection CtorArray(CodeStatement[] array) => new CodeStatementCollection(array); + protected override CodeStatementCollection CtorCollection(CodeStatementCollection collection) => new CodeStatementCollection(collection); - public override int Count(CodeStatementCollection collection) => collection.Count; + protected override int Count(CodeStatementCollection collection) => collection.Count; - public override CodeStatement GetItem(CodeStatementCollection collection, int index) => collection[index]; - public override void SetItem(CodeStatementCollection collection, int index, CodeStatement value) => collection[index] = value; + protected override CodeStatement GetItem(CodeStatementCollection collection, int index) => collection[index]; + protected override void SetItem(CodeStatementCollection collection, int index, CodeStatement value) => collection[index] = value; - public override void AddRange(CodeStatementCollection collection, CodeStatement[] array) => collection.AddRange(array); - public override void AddRange(CodeStatementCollection collection, CodeStatementCollection value) => collection.AddRange(value); + protected override void AddRange(CodeStatementCollection collection, CodeStatement[] array) => collection.AddRange(array); + protected override void AddRange(CodeStatementCollection collection, CodeStatementCollection value) => collection.AddRange(value); - public override object Add(CodeStatementCollection collection, CodeStatement obj) => collection.Add(obj); + protected override object Add(CodeStatementCollection collection, CodeStatement obj) => collection.Add(obj); - public override void Insert(CodeStatementCollection collection, int index, CodeStatement value) => collection.Insert(index, value); + protected override void Insert(CodeStatementCollection collection, int index, CodeStatement value) => collection.Insert(index, value); - public override void Remove(CodeStatementCollection collection, CodeStatement value) => collection.Remove(value); + protected override void Remove(CodeStatementCollection collection, CodeStatement value) => collection.Remove(value); - public override int IndexOf(CodeStatementCollection collection, CodeStatement value) => collection.IndexOf(value); - public override bool Contains(CodeStatementCollection collection, CodeStatement value) => collection.Contains(value); + protected override int IndexOf(CodeStatementCollection collection, CodeStatement value) => collection.IndexOf(value); + protected override bool Contains(CodeStatementCollection collection, CodeStatement value) => collection.Contains(value); - public override void CopyTo(CodeStatementCollection collection, CodeStatement[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeStatementCollection collection, CodeStatement[] array, int index) => collection.CopyTo(array, index); public static IEnumerable Add_CodeExpression_TestData() { diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeDeclarationCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeDeclarationCollectionTests.cs index bbdcefac662..2ec21822dc8 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeDeclarationCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeDeclarationCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeTypeDeclarationCollectionTests : CodeCollectionTestBase { - public override CodeTypeDeclarationCollection Ctor() => new CodeTypeDeclarationCollection(); - public override CodeTypeDeclarationCollection CtorArray(CodeTypeDeclaration[] array) => new CodeTypeDeclarationCollection(array); - public override CodeTypeDeclarationCollection CtorCollection(CodeTypeDeclarationCollection collection) => new CodeTypeDeclarationCollection(collection); + protected override CodeTypeDeclarationCollection Ctor() => new CodeTypeDeclarationCollection(); + protected override CodeTypeDeclarationCollection CtorArray(CodeTypeDeclaration[] array) => new CodeTypeDeclarationCollection(array); + protected override CodeTypeDeclarationCollection CtorCollection(CodeTypeDeclarationCollection collection) => new CodeTypeDeclarationCollection(collection); - public override int Count(CodeTypeDeclarationCollection collection) => collection.Count; + protected override int Count(CodeTypeDeclarationCollection collection) => collection.Count; - public override CodeTypeDeclaration GetItem(CodeTypeDeclarationCollection collection, int index) => collection[index]; - public override void SetItem(CodeTypeDeclarationCollection collection, int index, CodeTypeDeclaration value) => collection[index] = value; + protected override CodeTypeDeclaration GetItem(CodeTypeDeclarationCollection collection, int index) => collection[index]; + protected override void SetItem(CodeTypeDeclarationCollection collection, int index, CodeTypeDeclaration value) => collection[index] = value; - public override void AddRange(CodeTypeDeclarationCollection collection, CodeTypeDeclaration[] array) => collection.AddRange(array); - public override void AddRange(CodeTypeDeclarationCollection collection, CodeTypeDeclarationCollection value) => collection.AddRange(value); + protected override void AddRange(CodeTypeDeclarationCollection collection, CodeTypeDeclaration[] array) => collection.AddRange(array); + protected override void AddRange(CodeTypeDeclarationCollection collection, CodeTypeDeclarationCollection value) => collection.AddRange(value); - public override object Add(CodeTypeDeclarationCollection collection, CodeTypeDeclaration obj) => collection.Add(obj); + protected override object Add(CodeTypeDeclarationCollection collection, CodeTypeDeclaration obj) => collection.Add(obj); - public override void Insert(CodeTypeDeclarationCollection collection, int index, CodeTypeDeclaration value) => collection.Insert(index, value); + protected override void Insert(CodeTypeDeclarationCollection collection, int index, CodeTypeDeclaration value) => collection.Insert(index, value); - public override void Remove(CodeTypeDeclarationCollection collection, CodeTypeDeclaration value) => collection.Remove(value); + protected override void Remove(CodeTypeDeclarationCollection collection, CodeTypeDeclaration value) => collection.Remove(value); - public override int IndexOf(CodeTypeDeclarationCollection collection, CodeTypeDeclaration value) => collection.IndexOf(value); - public override bool Contains(CodeTypeDeclarationCollection collection, CodeTypeDeclaration value) => collection.Contains(value); + protected override int IndexOf(CodeTypeDeclarationCollection collection, CodeTypeDeclaration value) => collection.IndexOf(value); + protected override bool Contains(CodeTypeDeclarationCollection collection, CodeTypeDeclaration value) => collection.Contains(value); - public override void CopyTo(CodeTypeDeclarationCollection collection, CodeTypeDeclaration[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeTypeDeclarationCollection collection, CodeTypeDeclaration[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberCollectionTests.cs index 51a43f9926d..eb4ccbd04fc 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberCollectionTests.cs @@ -6,27 +6,27 @@ namespace System.CodeDom.Tests { public class CodeTypeMemberCollectionTests : CodeCollectionTestBase { - public override CodeTypeMemberCollection Ctor() => new CodeTypeMemberCollection(); - public override CodeTypeMemberCollection CtorArray(CodeTypeMember[] array) => new CodeTypeMemberCollection(array); - public override CodeTypeMemberCollection CtorCollection(CodeTypeMemberCollection collection) => new CodeTypeMemberCollection(collection); + protected override CodeTypeMemberCollection Ctor() => new CodeTypeMemberCollection(); + protected override CodeTypeMemberCollection CtorArray(CodeTypeMember[] array) => new CodeTypeMemberCollection(array); + protected override CodeTypeMemberCollection CtorCollection(CodeTypeMemberCollection collection) => new CodeTypeMemberCollection(collection); - public override int Count(CodeTypeMemberCollection collection) => collection.Count; + protected override int Count(CodeTypeMemberCollection collection) => collection.Count; - public override CodeTypeMember GetItem(CodeTypeMemberCollection collection, int index) => collection[index]; - public override void SetItem(CodeTypeMemberCollection collection, int index, CodeTypeMember value) => collection[index] = value; + protected override CodeTypeMember GetItem(CodeTypeMemberCollection collection, int index) => collection[index]; + protected override void SetItem(CodeTypeMemberCollection collection, int index, CodeTypeMember value) => collection[index] = value; - public override void AddRange(CodeTypeMemberCollection collection, CodeTypeMember[] array) => collection.AddRange(array); - public override void AddRange(CodeTypeMemberCollection collection, CodeTypeMemberCollection value) => collection.AddRange(value); + protected override void AddRange(CodeTypeMemberCollection collection, CodeTypeMember[] array) => collection.AddRange(array); + protected override void AddRange(CodeTypeMemberCollection collection, CodeTypeMemberCollection value) => collection.AddRange(value); - public override object Add(CodeTypeMemberCollection collection, CodeTypeMember obj) => collection.Add(obj); + protected override object Add(CodeTypeMemberCollection collection, CodeTypeMember obj) => collection.Add(obj); - public override void Insert(CodeTypeMemberCollection collection, int index, CodeTypeMember value) => collection.Insert(index, value); + protected override void Insert(CodeTypeMemberCollection collection, int index, CodeTypeMember value) => collection.Insert(index, value); - public override void Remove(CodeTypeMemberCollection collection, CodeTypeMember value) => collection.Remove(value); + protected override void Remove(CodeTypeMemberCollection collection, CodeTypeMember value) => collection.Remove(value); - public override int IndexOf(CodeTypeMemberCollection collection, CodeTypeMember value) => collection.IndexOf(value); - public override bool Contains(CodeTypeMemberCollection collection, CodeTypeMember value) => collection.Contains(value); + protected override int IndexOf(CodeTypeMemberCollection collection, CodeTypeMember value) => collection.IndexOf(value); + protected override bool Contains(CodeTypeMemberCollection collection, CodeTypeMember value) => collection.Contains(value); - public override void CopyTo(CodeTypeMemberCollection collection, CodeTypeMember[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeTypeMemberCollection collection, CodeTypeMember[] array, int index) => collection.CopyTo(array, index); } } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs index 2d785f63e8a..12c7b9978a6 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs @@ -8,28 +8,28 @@ namespace System.CodeDom.Tests { public class CodeTypeParameterCollectionTests : CodeCollectionTestBase { - public override CodeTypeParameterCollection Ctor() => new CodeTypeParameterCollection(); - public override CodeTypeParameterCollection CtorArray(CodeTypeParameter[] array) => new CodeTypeParameterCollection(array); - public override CodeTypeParameterCollection CtorCollection(CodeTypeParameterCollection collection) => new CodeTypeParameterCollection(collection); + protected override CodeTypeParameterCollection Ctor() => new CodeTypeParameterCollection(); + protected override CodeTypeParameterCollection CtorArray(CodeTypeParameter[] array) => new CodeTypeParameterCollection(array); + protected override CodeTypeParameterCollection CtorCollection(CodeTypeParameterCollection collection) => new CodeTypeParameterCollection(collection); - public override int Count(CodeTypeParameterCollection collection) => collection.Count; + protected override int Count(CodeTypeParameterCollection collection) => collection.Count; - public override CodeTypeParameter GetItem(CodeTypeParameterCollection collection, int index) => collection[index]; - public override void SetItem(CodeTypeParameterCollection collection, int index, CodeTypeParameter value) => collection[index] = value; + protected override CodeTypeParameter GetItem(CodeTypeParameterCollection collection, int index) => collection[index]; + protected override void SetItem(CodeTypeParameterCollection collection, int index, CodeTypeParameter value) => collection[index] = value; - public override void AddRange(CodeTypeParameterCollection collection, CodeTypeParameter[] array) => collection.AddRange(array); - public override void AddRange(CodeTypeParameterCollection collection, CodeTypeParameterCollection value) => collection.AddRange(value); + protected override void AddRange(CodeTypeParameterCollection collection, CodeTypeParameter[] array) => collection.AddRange(array); + protected override void AddRange(CodeTypeParameterCollection collection, CodeTypeParameterCollection value) => collection.AddRange(value); - public override object Add(CodeTypeParameterCollection collection, CodeTypeParameter obj) => collection.Add(obj); + protected override object Add(CodeTypeParameterCollection collection, CodeTypeParameter obj) => collection.Add(obj); - public override void Insert(CodeTypeParameterCollection collection, int index, CodeTypeParameter value) => collection.Insert(index, value); + protected override void Insert(CodeTypeParameterCollection collection, int index, CodeTypeParameter value) => collection.Insert(index, value); - public override void Remove(CodeTypeParameterCollection collection, CodeTypeParameter value) => collection.Remove(value); + protected override void Remove(CodeTypeParameterCollection collection, CodeTypeParameter value) => collection.Remove(value); - public override int IndexOf(CodeTypeParameterCollection collection, CodeTypeParameter value) => collection.IndexOf(value); - public override bool Contains(CodeTypeParameterCollection collection, CodeTypeParameter value) => collection.Contains(value); + protected override int IndexOf(CodeTypeParameterCollection collection, CodeTypeParameter value) => collection.IndexOf(value); + protected override bool Contains(CodeTypeParameterCollection collection, CodeTypeParameter value) => collection.Contains(value); - public override void CopyTo(CodeTypeParameterCollection collection, CodeTypeParameter[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeTypeParameterCollection collection, CodeTypeParameter[] array, int index) => collection.CopyTo(array, index); [Theory] [InlineData(null)] diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceCollectionTests.cs index 97c7c35f291..df7f2b4d511 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceCollectionTests.cs @@ -8,28 +8,28 @@ namespace System.CodeDom.Tests { public class CodeTypeReferenceCollectionTests : CodeCollectionTestBase { - public override CodeTypeReferenceCollection Ctor() => new CodeTypeReferenceCollection(); - public override CodeTypeReferenceCollection CtorArray(CodeTypeReference[] array) => new CodeTypeReferenceCollection(array); - public override CodeTypeReferenceCollection CtorCollection(CodeTypeReferenceCollection collection) => new CodeTypeReferenceCollection(collection); + protected override CodeTypeReferenceCollection Ctor() => new CodeTypeReferenceCollection(); + protected override CodeTypeReferenceCollection CtorArray(CodeTypeReference[] array) => new CodeTypeReferenceCollection(array); + protected override CodeTypeReferenceCollection CtorCollection(CodeTypeReferenceCollection collection) => new CodeTypeReferenceCollection(collection); - public override int Count(CodeTypeReferenceCollection collection) => collection.Count; + protected override int Count(CodeTypeReferenceCollection collection) => collection.Count; - public override CodeTypeReference GetItem(CodeTypeReferenceCollection collection, int index) => collection[index]; - public override void SetItem(CodeTypeReferenceCollection collection, int index, CodeTypeReference value) => collection[index] = value; + protected override CodeTypeReference GetItem(CodeTypeReferenceCollection collection, int index) => collection[index]; + protected override void SetItem(CodeTypeReferenceCollection collection, int index, CodeTypeReference value) => collection[index] = value; - public override void AddRange(CodeTypeReferenceCollection collection, CodeTypeReference[] array) => collection.AddRange(array); - public override void AddRange(CodeTypeReferenceCollection collection, CodeTypeReferenceCollection value) => collection.AddRange(value); + protected override void AddRange(CodeTypeReferenceCollection collection, CodeTypeReference[] array) => collection.AddRange(array); + protected override void AddRange(CodeTypeReferenceCollection collection, CodeTypeReferenceCollection value) => collection.AddRange(value); - public override object Add(CodeTypeReferenceCollection collection, CodeTypeReference obj) => collection.Add(obj); + protected override object Add(CodeTypeReferenceCollection collection, CodeTypeReference obj) => collection.Add(obj); - public override void Insert(CodeTypeReferenceCollection collection, int index, CodeTypeReference value) => collection.Insert(index, value); + protected override void Insert(CodeTypeReferenceCollection collection, int index, CodeTypeReference value) => collection.Insert(index, value); - public override void Remove(CodeTypeReferenceCollection collection, CodeTypeReference value) => collection.Remove(value); + protected override void Remove(CodeTypeReferenceCollection collection, CodeTypeReference value) => collection.Remove(value); - public override int IndexOf(CodeTypeReferenceCollection collection, CodeTypeReference value) => collection.IndexOf(value); - public override bool Contains(CodeTypeReferenceCollection collection, CodeTypeReference value) => collection.Contains(value); + protected override int IndexOf(CodeTypeReferenceCollection collection, CodeTypeReference value) => collection.IndexOf(value); + protected override bool Contains(CodeTypeReferenceCollection collection, CodeTypeReference value) => collection.Contains(value); - public override void CopyTo(CodeTypeReferenceCollection collection, CodeTypeReference[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CodeTypeReferenceCollection collection, CodeTypeReference[] array, int index) => collection.CopyTo(array, index); [Theory] [InlineData(null)] diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorCollectionTests.cs index 732dfa156c9..0eebdb98aef 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorCollectionTests.cs @@ -12,28 +12,28 @@ namespace System.CodeDom.Compiler.Tests { public class CompilerErrorCollectionTests : CodeCollectionTestBase { - public override CompilerErrorCollection Ctor() => new CompilerErrorCollection(); - public override CompilerErrorCollection CtorArray(CompilerError[] array) => new CompilerErrorCollection(array); - public override CompilerErrorCollection CtorCollection(CompilerErrorCollection collection) => new CompilerErrorCollection(collection); + protected override CompilerErrorCollection Ctor() => new CompilerErrorCollection(); + protected override CompilerErrorCollection CtorArray(CompilerError[] array) => new CompilerErrorCollection(array); + protected override CompilerErrorCollection CtorCollection(CompilerErrorCollection collection) => new CompilerErrorCollection(collection); - public override int Count(CompilerErrorCollection collection) => collection.Count; + protected override int Count(CompilerErrorCollection collection) => collection.Count; - public override CompilerError GetItem(CompilerErrorCollection collection, int index) => collection[index]; - public override void SetItem(CompilerErrorCollection collection, int index, CompilerError value) => collection[index] = value; + protected override CompilerError GetItem(CompilerErrorCollection collection, int index) => collection[index]; + protected override void SetItem(CompilerErrorCollection collection, int index, CompilerError value) => collection[index] = value; - public override void AddRange(CompilerErrorCollection collection, CompilerError[] array) => collection.AddRange(array); - public override void AddRange(CompilerErrorCollection collection, CompilerErrorCollection value) => collection.AddRange(value); + protected override void AddRange(CompilerErrorCollection collection, CompilerError[] array) => collection.AddRange(array); + protected override void AddRange(CompilerErrorCollection collection, CompilerErrorCollection value) => collection.AddRange(value); - public override object Add(CompilerErrorCollection collection, CompilerError obj) => collection.Add(obj); + protected override object Add(CompilerErrorCollection collection, CompilerError obj) => collection.Add(obj); - public override void Insert(CompilerErrorCollection collection, int index, CompilerError value) => collection.Insert(index, value); + protected override void Insert(CompilerErrorCollection collection, int index, CompilerError value) => collection.Insert(index, value); - public override void Remove(CompilerErrorCollection collection, CompilerError value) => collection.Remove(value); + protected override void Remove(CompilerErrorCollection collection, CompilerError value) => collection.Remove(value); - public override int IndexOf(CompilerErrorCollection collection, CompilerError value) => collection.IndexOf(value); - public override bool Contains(CompilerErrorCollection collection, CompilerError value) => collection.Contains(value); + protected override int IndexOf(CompilerErrorCollection collection, CompilerError value) => collection.IndexOf(value); + protected override bool Contains(CompilerErrorCollection collection, CompilerError value) => collection.Contains(value); - public override void CopyTo(CompilerErrorCollection collection, CompilerError[] array, int index) => collection.CopyTo(array, index); + protected override void CopyTo(CompilerErrorCollection collection, CompilerError[] array, int index) => collection.CopyTo(array, index); [Fact] public void HasWarnings_Empty_ReturnsFalse() diff --git a/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionCancellationTests.cs b/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionCancellationTests.cs index 1bbb288e4f8..4c8fe1b4a57 100644 --- a/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionCancellationTests.cs +++ b/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionCancellationTests.cs @@ -159,7 +159,7 @@ namespace System.Collections.Concurrent.Tests #region Helper Methods - public static void EnsureOperationCanceledExceptionThrown(Action action, CancellationToken token, string message) + private static void EnsureOperationCanceledExceptionThrown(Action action, CancellationToken token, string message) { OperationCanceledException operationCanceledEx = Assert.Throws(action); // "BlockingCollectionCancellationTests: OperationCanceledException not thrown."); diff --git a/src/libraries/System.Collections.Concurrent/tests/IntRangePartitionerTests.cs b/src/libraries/System.Collections.Concurrent/tests/IntRangePartitionerTests.cs index e5ac3406c28..6b141d011d3 100644 --- a/src/libraries/System.Collections.Concurrent/tests/IntRangePartitionerTests.cs +++ b/src/libraries/System.Collections.Concurrent/tests/IntRangePartitionerTests.cs @@ -59,7 +59,7 @@ namespace System.Collections.Concurrent.Tests CheckGetPartitions(-2147483648, 5000, 63); } - public static void CheckGetPartitions(int from, int count, int dop) + private static void CheckGetPartitions(int from, int count, int dop) { int to = from + count; var partitioner = Partitioner.Create(from, to); @@ -92,7 +92,7 @@ namespace System.Collections.Concurrent.Tests CheckGetDynamicPartitions(-2147483648, 5000); } - public static void CheckGetDynamicPartitions(int from, int count) + private static void CheckGetDynamicPartitions(int from, int count) { int to = from + count; var partitioner = Partitioner.Create(from, to); @@ -124,7 +124,7 @@ namespace System.Collections.Concurrent.Tests CheckGetOrderablePartitions(-2147483648, 5000, 63); } - public static void CheckGetOrderablePartitions(int from, int count, int dop) + private static void CheckGetOrderablePartitions(int from, int count, int dop) { int to = from + count; var partitioner = Partitioner.Create(from, to); @@ -207,7 +207,7 @@ namespace System.Collections.Concurrent.Tests CheckGetPartitionsWithRange(-2147483648, 1000, 19, 63); } - public static void CheckGetPartitionsWithRange(int from, int count, int desiredRangeSize, int dop) + private static void CheckGetPartitionsWithRange(int from, int count, int desiredRangeSize, int dop) { int to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); @@ -250,7 +250,7 @@ namespace System.Collections.Concurrent.Tests CheckGetDynamicPartitionsWithRange(-2147483648, 1000, 19); } - public static void CheckGetDynamicPartitionsWithRange(int from, int count, int desiredRangeSize) + private static void CheckGetDynamicPartitionsWithRange(int from, int count, int desiredRangeSize) { int to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); @@ -384,7 +384,7 @@ namespace System.Collections.Concurrent.Tests /// /// /// - public static void ValidateRangeSize(int desiredRangeSize, IList rangeSizes) + private static void ValidateRangeSize(int desiredRangeSize, IList rangeSizes) { //var rangesWithDifferentRangeSize = rangeSizes.Take(rangeSizes.Length - 1).Where(r => r != desiredRangeSize).ToArray(); IList rangesWithDifferentRangeSize = new List(); @@ -413,7 +413,7 @@ namespace System.Collections.Concurrent.Tests /// /// /// - public static void RangePartitionerChunking(int from, int count, int rangeSize) + private static void RangePartitionerChunking(int from, int count, int rangeSize) { int to = from + count; @@ -493,7 +493,7 @@ namespace System.Collections.Concurrent.Tests /// /// /// - public static void RangePartitionerDynamicChunking(int from, int count, int rangeSize) + private static void RangePartitionerDynamicChunking(int from, int count, int rangeSize) { int to = from + count; diff --git a/src/libraries/System.Collections.Concurrent/tests/LongRangePartitionerTests.cs b/src/libraries/System.Collections.Concurrent/tests/LongRangePartitionerTests.cs index 9ce33a97311..6416443855c 100644 --- a/src/libraries/System.Collections.Concurrent/tests/LongRangePartitionerTests.cs +++ b/src/libraries/System.Collections.Concurrent/tests/LongRangePartitionerTests.cs @@ -61,7 +61,7 @@ namespace System.Collections.Concurrent.Tests CheckGetPartitions(9223372036854774807, 999, 13); // close to Int64.Max } - public static void CheckGetPartitions(long from, long count, int dop) + private static void CheckGetPartitions(long from, long count, int dop) { long to = from + count; var partitioner = Partitioner.Create(from, to); @@ -93,7 +93,7 @@ namespace System.Collections.Concurrent.Tests CheckGetDynamicPartitions(9223372036854774807, 999); // close to Int64.Max } - public static void CheckGetDynamicPartitions(long from, long count) + private static void CheckGetDynamicPartitions(long from, long count) { long to = from + count; var partitioner = Partitioner.Create(from, to); @@ -126,7 +126,7 @@ namespace System.Collections.Concurrent.Tests CheckGetOrderablePartitions(9223372036854774807, 999, 13); // close to Int64.Max } - public static void CheckGetOrderablePartitions(long from, long count, int dop) + private static void CheckGetOrderablePartitions(long from, long count, int dop) { long to = from + count; var partitioner = Partitioner.Create(from, to); @@ -171,7 +171,7 @@ namespace System.Collections.Concurrent.Tests GetOrderableDynamicPartitions(9223372036854774807, 999); // close to Int64.Max } - public static void GetOrderableDynamicPartitions(long from, long count) + private static void GetOrderableDynamicPartitions(long from, long count) { long to = from + count; var partitioner = Partitioner.Create(from, to); @@ -212,7 +212,7 @@ namespace System.Collections.Concurrent.Tests CheckGetPartitionsWithRange(-9223372036854774807, 1000, 19, 63); } - public static void CheckGetPartitionsWithRange(long from, long count, long desiredRangeSize, int dop) + private static void CheckGetPartitionsWithRange(long from, long count, long desiredRangeSize, int dop) { long to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); @@ -254,7 +254,7 @@ namespace System.Collections.Concurrent.Tests CheckGetDynamicPartitionsWithRange(-9223372036854774807, 1000, 19); } - public static void CheckGetDynamicPartitionsWithRange(long from, long count, long desiredRangeSize) + private static void CheckGetDynamicPartitionsWithRange(long from, long count, long desiredRangeSize) { long to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); @@ -296,7 +296,7 @@ namespace System.Collections.Concurrent.Tests CheckGetOrderablePartitionsWithRange(-9223372036854774807, 1000, 19, 63); } - public static void CheckGetOrderablePartitionsWithRange(long from, long count, long desiredRangeSize, int dop) + private static void CheckGetOrderablePartitionsWithRange(long from, long count, long desiredRangeSize, int dop) { long to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); @@ -349,7 +349,7 @@ namespace System.Collections.Concurrent.Tests GetOrderableDynamicPartitionsWithRange(-9223372036854774807, 1000, 19); } - public static void GetOrderableDynamicPartitionsWithRange(long from, long count, long desiredRangeSize) + private static void GetOrderableDynamicPartitionsWithRange(long from, long count, long desiredRangeSize) { long to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); @@ -389,7 +389,7 @@ namespace System.Collections.Concurrent.Tests /// /// /// - public static void ValidateRangeSize(long desiredRangeSize, IList rangeSizes) + private static void ValidateRangeSize(long desiredRangeSize, IList rangeSizes) { //var rangesWithDifferentRangeSize = rangeSizes.Take(rangeSizes.Length - 1).Where(r => r != desiredRangeSize).ToArray(); IList rangesWithDifferentRangeSize = new List(); @@ -415,7 +415,7 @@ namespace System.Collections.Concurrent.Tests RangePartitionerChunking(2147484647, 1000, -1); } - public static void RangePartitionerChunking(long from, long count, long rangeSize) + private static void RangePartitionerChunking(long from, long count, long rangeSize) { long to = from + count; @@ -488,7 +488,7 @@ namespace System.Collections.Concurrent.Tests RangePartitionerDynamicChunking(2147484647, 1000, -1); } - public static void RangePartitionerDynamicChunking(long from, long count, long rangeSize) + private static void RangePartitionerDynamicChunking(long from, long count, long rangeSize) { long to = from + count; diff --git a/src/libraries/System.Collections.Concurrent/tests/RangePartitionerNegativeTests.cs b/src/libraries/System.Collections.Concurrent/tests/RangePartitionerNegativeTests.cs index 78acc59d488..0a0fa4eed58 100644 --- a/src/libraries/System.Collections.Concurrent/tests/RangePartitionerNegativeTests.cs +++ b/src/libraries/System.Collections.Concurrent/tests/RangePartitionerNegativeTests.cs @@ -33,7 +33,7 @@ namespace System.Collections.Concurrent.Tests IntFromNotGreaterThanTo(-19999, -299999, 100); } - public static void IntFromNotGreaterThanTo(int from, int to, int rangesize) + private static void IntFromNotGreaterThanTo(int from, int to, int rangesize) { Assert.Throws(() => Partitioner.Create(from, to)); Assert.Throws(() => Partitioner.Create(from, to, rangesize)); @@ -49,7 +49,7 @@ namespace System.Collections.Concurrent.Tests LongFromNotGreaterThanTo(-19999, -299999, 100); } - public static void LongFromNotGreaterThanTo(long from, long to, int rangesize) + private static void LongFromNotGreaterThanTo(long from, long to, int rangesize) { Assert.Throws(() => Partitioner.Create(from, to)); Assert.Throws(() => Partitioner.Create(from, to, rangesize)); @@ -65,7 +65,7 @@ namespace System.Collections.Concurrent.Tests InvalidIntRangeSize(899, 9000, -10); } - public static void InvalidIntRangeSize(int from, int to, int rangesize) + private static void InvalidIntRangeSize(int from, int to, int rangesize) { Assert.Throws(() => Partitioner.Create(from, to, rangesize)); } @@ -80,7 +80,7 @@ namespace System.Collections.Concurrent.Tests InvalidLongRangeSize(899, 9000, -10); } - public static void InvalidLongRangeSize(long from, long to, long rangesize) + private static void InvalidLongRangeSize(long from, long to, long rangesize) { Assert.Throws(() => Partitioner.Create(from, to, rangesize)); } diff --git a/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs b/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs index d2afc9ad812..5991d827cc7 100644 --- a/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs +++ b/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs @@ -425,7 +425,7 @@ namespace System.Collections.Immutable.Tests Assert.IsType(tie.InnerException); } - ////[Fact] // not really a functional test -- but very useful to enable when collecting perf traces. + [Fact(Skip = "Useful to enable when collecting perf traces")] public void EnumerationPerformance() { var dictionary = Enumerable.Range(1, 1000).ToImmutableSortedDictionary(k => k, k => k); @@ -450,7 +450,7 @@ namespace System.Collections.Immutable.Tests Debug.WriteLine("Timing:{0}{1}", Environment.NewLine, timingText); } - ////[Fact] // not really a functional test -- but very useful to enable when collecting perf traces. + [Fact(Skip = "Useful to enable when collecting perf traces")] public void EnumerationPerformance_Empty() { var dictionary = ImmutableSortedDictionary.Empty; diff --git a/src/libraries/System.Collections.NonGeneric/tests/ArrayListTests.cs b/src/libraries/System.Collections.NonGeneric/tests/ArrayListTests.cs index 490def1da04..601853673c2 100644 --- a/src/libraries/System.Collections.NonGeneric/tests/ArrayListTests.cs +++ b/src/libraries/System.Collections.NonGeneric/tests/ArrayListTests.cs @@ -2909,7 +2909,7 @@ namespace System.Collections.Tests Assert.Equal(0, _iList.Count); } - public void AddElems(string currThreadName) + private void AddElems(string currThreadName) { int iNumTimesThreadUsed = 0; diff --git a/src/libraries/System.Collections.NonGeneric/tests/QueueTests.cs b/src/libraries/System.Collections.NonGeneric/tests/QueueTests.cs index 25552712c7b..0a04fbc3bf9 100644 --- a/src/libraries/System.Collections.NonGeneric/tests/QueueTests.cs +++ b/src/libraries/System.Collections.NonGeneric/tests/QueueTests.cs @@ -956,7 +956,7 @@ namespace System.Collections.Tests AssertExtensions.Throws("queue", () => Queue.Synchronized(null)); // Queue is null } - public void StartEnqueueThread() + private void StartEnqueueThread() { int t_age = _threadAge; while (t_age > 0) diff --git a/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs b/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs index ae55980f097..9b001390f6d 100644 --- a/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs +++ b/src/libraries/System.Collections.Specialized/tests/BitVector32Tests.cs @@ -496,6 +496,7 @@ namespace System.Collections.Specialized.Tests Assert.Equal(left.GetHashCode(), right.GetHashCode()); } + [Fact] public static void Section_ToStringTest() { Random random = new Random(-55); diff --git a/src/libraries/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.CtorTests.cs b/src/libraries/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.CtorTests.cs index 7068e3de94d..a5d57997889 100644 --- a/src/libraries/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.CtorTests.cs +++ b/src/libraries/System.Collections.Specialized/tests/HybridDictionary/HybridDictionary.CtorTests.cs @@ -38,13 +38,13 @@ namespace System.Collections.Specialized.Tests VerifyCtor(hybridDictionary, caseInsensitive: caseInsensitive); } - public void Ctor_Int_Bool(int initialSize, bool caseInsensitive) + private static void Ctor_Int_Bool(int initialSize, bool caseInsensitive) { HybridDictionary hybridDictionary = new HybridDictionary(initialSize, caseInsensitive); VerifyCtor(hybridDictionary, caseInsensitive: caseInsensitive); } - public static void VerifyCtor(HybridDictionary hybridDictionary, bool caseInsensitive) + private static void VerifyCtor(HybridDictionary hybridDictionary, bool caseInsensitive) { Assert.Equal(0, hybridDictionary.Count); Assert.Equal(0, hybridDictionary.Keys.Count); diff --git a/src/libraries/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs b/src/libraries/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs index 2bbcf9ce07a..f4e022abef7 100644 --- a/src/libraries/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs +++ b/src/libraries/System.Collections.Specialized/tests/NameObjectCollectionBase/NameObjectCollectionBase.KeysTests.cs @@ -121,7 +121,7 @@ namespace System.Collections.Specialized.Tests Keys_CopyTo(nameObjectCollection, 0); } - public void Keys_CopyTo(MyNameObjectCollection nameObjectCollection, int index) + private static void Keys_CopyTo(MyNameObjectCollection nameObjectCollection, int index) { ICollection keys = nameObjectCollection.Keys; string[] keysArray = new string[index + keys.Count + index]; diff --git a/src/libraries/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CtorTests.cs b/src/libraries/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CtorTests.cs index e8beca425c1..9dbe848d3fe 100644 --- a/src/libraries/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CtorTests.cs +++ b/src/libraries/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.CtorTests.cs @@ -178,7 +178,7 @@ namespace System.Collections.Specialized.Tests VerifyCtor_IEqualityComparer(nameValueCollection, equalityComparer, 10); } - public void VerifyCtor_IEqualityComparer(NameValueCollection nameValueCollection, IEqualityComparer equalityComparer, int newCount) + private static void VerifyCtor_IEqualityComparer(NameValueCollection nameValueCollection, IEqualityComparer equalityComparer, int newCount) { Assert.Equal(0, nameValueCollection.Count); Assert.Equal(0, nameValueCollection.Keys.Count); diff --git a/src/libraries/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Constructor.cs b/src/libraries/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Constructor.cs index a3c3ef93a5d..6037e812183 100644 --- a/src/libraries/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Constructor.cs +++ b/src/libraries/System.Collections/tests/Generic/LinkedList/LinkedList.Generic.Tests.Constructor.cs @@ -89,7 +89,7 @@ namespace System.Collections.Tests /// /// Tests the linked list based on the expected items and the given linked list. /// - internal LinkedList_T_Tests(LinkedList collection, T[] expectedItems) + public LinkedList_T_Tests(LinkedList collection, T[] expectedItems) { _collection = collection; _expectedItems = expectedItems; @@ -98,7 +98,6 @@ namespace System.Collections.Tests /// /// Tests the initial items in the list. /// - [Fact] public void InitialItems_Tests() { VerifyState(_collection, _expectedItems); diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionContainerCollectionTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionContainerCollectionTests.cs index d7482b7382b..d8a42872ca4 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionContainerCollectionTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionContainerCollectionTests.cs @@ -862,7 +862,7 @@ namespace System.ComponentModel.Composition Assert.Equal(2, importer.MyCollection.Count); } - public void ExpectedErrorOnPartActivate(object importer, ErrorId expectedErrorId) + private static void ExpectedErrorOnPartActivate(object importer, ErrorId expectedErrorId) { var container = ContainerFactory.Create(); var batch = new CompositionBatch(); @@ -877,7 +877,7 @@ namespace System.ComponentModel.Composition }); } - public void ExpectedErrorOnSetImport(object importer, ErrorId expectedErrorId) + private static void ExpectedErrorOnSetImport(object importer, ErrorId expectedErrorId) { var container = ContainerFactory.Create(); var batch = new CompositionBatch(); @@ -892,7 +892,7 @@ namespace System.ComponentModel.Composition }); } - public void ExpectedChangeRejectedErrorOnSetImport(object importer, ErrorId expectedErrorId) + private static void ExpectedChangeRejectedErrorOnSetImport(object importer, ErrorId expectedErrorId) { var container = ContainerFactory.Create(); var batch = new CompositionBatch(); diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AggregateCatalogTest.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AggregateCatalogTest.cs index 099fb954dcf..321d806369c 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AggregateCatalogTest.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AggregateCatalogTest.cs @@ -471,7 +471,7 @@ namespace System.ComponentModel.Composition.Hosting Assert.True(catalog.Catalogs.Count == 0); } - public void CreateMainAndOtherChildren( + private static void CreateMainAndOtherChildren( out AggregateCatalog[] mainChildren, out AggregateCatalog[] otherChildren, out TypeCatalog[] componentCatalogs) diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs index 2a9ffef3faf..a286dd708e0 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/AssemblyCatalogTests.cs @@ -69,7 +69,7 @@ namespace System.ComponentModel.Composition public class AssemblyCatalogConstructorTests : AssemblyCatalogTestsHelper { // Test Codebase variant of the APIs - public static void Constructor_ValueAsCodebaseArgument_ShouldSetAssemblyProperty(Func catalogCreator) + internal static void Constructor_ValueAsCodebaseArgument_ShouldSetAssemblyProperty(Func catalogCreator) { var expectations = Expectations.GetAssemblies(); @@ -81,7 +81,7 @@ namespace System.ComponentModel.Composition } } - public static void Constructor_LockedFileAsCodeBaseArgument_ShouldThrowFileLoad(Func catalogCreator) + internal static void Constructor_LockedFileAsCodeBaseArgument_ShouldThrowFileLoad(Func catalogCreator) { string filename = Path.GetTempFileName(); using (FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None)) @@ -97,27 +97,27 @@ namespace System.ComponentModel.Composition } } - public static void Constructor_NullFileNameAsCodeBaseArgument_ShouldThrowArgumentNull(Func catalogCreator) + internal static void Constructor_NullFileNameAsCodeBaseArgument_ShouldThrowArgumentNull(Func catalogCreator) { Assert.Throws("codeBase", () => catalogCreator(null)); } - public static void Constructor_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument(Func catalogCreator) + internal static void Constructor_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument(Func catalogCreator) { Assert.Throws("codeBase", () => catalogCreator("")); } - public static void Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument(Func catalogCreator) + internal static void Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument(Func catalogCreator) { Assert.Throws(() => catalogCreator("??||>")); } - public static void Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO(Func catalogCreator) + internal static void Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO(Func catalogCreator) { Assert.ThrowsAny(() => catalogCreator("??||>")); } - public static void Constructor_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad(Func catalogCreator) + internal static void Constructor_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad(Func catalogCreator) { string directory = Environment.GetFolderPath(Environment.SpecialFolder.System); Assert.True(Directory.Exists(directory)); @@ -125,25 +125,25 @@ namespace System.ComponentModel.Composition Assert.Throws(() => catalogCreator(directory)); } - public static void Constructor_TooLongFileNameAsCodeBaseArgument_ShouldThrowPathTooLong(Func catalogCreator) + internal static void Constructor_TooLongFileNameAsCodeBaseArgument_ShouldThrowPathTooLong(Func catalogCreator) { Assert.Throws(() => catalogCreator(@"c:\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\myassembly.dll")); } - public static void Constructor_NonAssemblyFileNameAsCodeBaseArgument_ShouldThrowBadImageFormat(Func catalogCreator) + internal static void Constructor_NonAssemblyFileNameAsCodeBaseArgument_ShouldThrowBadImageFormat(Func catalogCreator) { string filename = Path.GetTempFileName(); Assert.Throws(() => catalogCreator(filename)); } - public static void Constructor_NonExistentFileNameAsCodeBaseArgument_ShouldThrowFileNotFound(Func catalogCreator) + internal static void Constructor_NonExistentFileNameAsCodeBaseArgument_ShouldThrowFileNotFound(Func catalogCreator) { Assert.Throws(() => catalogCreator(@"FileThat should not ever exist")); } // Test Assembly variant of the APIs - public static void Constructor_ValueAsAssemblyArgument_ShouldSetAssemblyProperty(Func catalogCreator) + internal static void Constructor_ValueAsAssemblyArgument_ShouldSetAssemblyProperty(Func catalogCreator) { var expectations = Expectations.GetAssemblies(); @@ -155,12 +155,12 @@ namespace System.ComponentModel.Composition } } - public static void Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull(Func catalogCreator) + internal static void Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull(Func catalogCreator) { AssertExtensions.Throws("reflectionContext", () => catalogCreator(null)); } - public static void Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull(Func catalogCreator) + internal static void Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull(Func catalogCreator) { AssertExtensions.Throws("definitionOrigin", () => catalogCreator(null)); } diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs index d66dd92d472..ac6437320f4 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs @@ -38,7 +38,7 @@ namespace System.ComponentModel.Composition { internal const string NonExistentSearchPattern = "*.NonExistentSearchPattern"; - public static void Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull(Func catalogCreator) + private static void Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull(Func catalogCreator) { Assert.Throws("reflectionContext", () => { @@ -46,7 +46,7 @@ namespace System.ComponentModel.Composition }); } - public static void Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull(Func catalogCreator) + private static void Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull(Func catalogCreator) { Assert.Throws("definitionOrigin", () => { diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs index a78fa915b40..cadabae5822 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/TypeCatalogTests.cs @@ -36,7 +36,7 @@ namespace System.ComponentModel.Composition public class TypeCatalogTests { - public static void Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull(Func catalogCreator) + private static void Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull(Func catalogCreator) { Assert.Throws("reflectionContext", () => { @@ -44,7 +44,7 @@ namespace System.ComponentModel.Composition }); } - public static void Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull(Func catalogCreator) + private static void Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull(Func catalogCreator) { Assert.Throws("definitionOrigin", () => { diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs index 97ad8c777b6..05befab857f 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs @@ -581,7 +581,7 @@ namespace System.ComponentModel.Composition SelectiveImportBySTMThroughCatalog1(container); } - public void SelectiveImportBySTMThroughCatalog1(CompositionContainer container) + private static void SelectiveImportBySTMThroughCatalog1(CompositionContainer container) { Assert.NotNull(container.GetExport()); var result2 = container.GetExports(); @@ -595,7 +595,7 @@ namespace System.ComponentModel.Composition SelectiveImportBySTMThroughCatalog2(container); } - public void SelectiveImportBySTMThroughCatalog2(CompositionContainer container) + private static void SelectiveImportBySTMThroughCatalog2(CompositionContainer container) { throw new NotImplementedException(); diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesTests.cs index ce62f3c57d5..e7de7212cef 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServicesTests.cs @@ -482,6 +482,7 @@ namespace System.ComponentModel.Composition.ReflectionModel }); } + [Fact] public void CreateExportDefinition_NullAsMetadata_Allowed() { PropertyInfo property = typeof(TestPart).GetProperties().First(); @@ -496,7 +497,7 @@ namespace System.ComponentModel.Composition.ReflectionModel ExportDefinition definition = ReflectionModelServices.CreateExportDefinition(expectedLazyMember, expectedContractName, expectedMetadata.AsLazy(), expectedOrigin); Assert.NotNull(definition.Metadata); - Assert.Equal(0, definition.Metadata.Count); + Assert.Equal(2, definition.Metadata.Count); } [Fact] diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/Integration/LifetimeTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/Integration/LifetimeTests.cs index af28b5037a8..10b5579cf06 100644 --- a/src/libraries/System.ComponentModel.Composition/tests/System/Integration/LifetimeTests.cs +++ b/src/libraries/System.ComponentModel.Composition/tests/System/Integration/LifetimeTests.cs @@ -666,6 +666,7 @@ namespace Tests.Integration } } + [Fact] public void GetReleaseExport_NonSharedRoot_ShouldDisposeChain_WithMetadata() { var container = GetContainer(); diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/CallbackValidatorTest.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/CallbackValidatorTest.cs index d07fbc77a2a..a2c853133b5 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/CallbackValidatorTest.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/CallbackValidatorTest.cs @@ -46,16 +46,6 @@ namespace MonoTests.System.Configuration Assert.False(v.CanValidate(typeof(object))); } - public void NullCallback() - { - CallbackValidator v = new CallbackValidator(typeof(int), null); - } - - public void NullType() - { - CallbackValidator v = new CallbackValidator(null, success); - } - bool hit_success; bool hit_failure; diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationSaveTest.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationSaveTest.cs index c4e0310279b..4267ee13f7c 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationSaveTest.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationSaveTest.cs @@ -200,10 +200,10 @@ namespace MonoTests.System.Configuration } } - public delegate void TestFunction(SysConfig config, TestLabel label); - public delegate void XmlCheckFunction(XPathNavigator nav, TestLabel label); + private delegate void TestFunction(SysConfig config, TestLabel label); + private delegate void XmlCheckFunction(XPathNavigator nav, TestLabel label); - public static void Run(string name, TestFunction func) + private static void Run(string name, TestFunction func) { var label = new TestLabel(name); @@ -218,26 +218,26 @@ namespace MonoTests.System.Configuration }); } - public static void Run(string name, TestFunction func) + private static void Run(string name, TestFunction func) where TConfig : ConfigProvider, new() { Run(new TestLabel(name), func, null); } - public static void Run(TestLabel label, TestFunction func) + private static void Run(TestLabel label, TestFunction func) where TConfig : ConfigProvider, new() { Run(label, func, null); } - public static void Run( + private static void Run( string name, TestFunction func, XmlCheckFunction check) where TConfig : ConfigProvider, new() { Run(new TestLabel(name), func, check); } - public static void Run( + private static void Run( TestLabel label, TestFunction func, XmlCheckFunction check) where TConfig : ConfigProvider, new() { diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CallBackValidatorAttributeTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CallBackValidatorAttributeTests.cs index 08a7aa107df..c5df53bf058 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CallBackValidatorAttributeTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/CallBackValidatorAttributeTests.cs @@ -92,6 +92,7 @@ namespace System.Configuration Assert.Equal("12345", testCallBackValidatorAttribute.CallbackMethodName); } +#pragma warning disable xUnit1013 // Required to be public for CallbackValidatorAttribute to work public static void CallBackValidatorTestMethod(object o) { } @@ -99,6 +100,7 @@ namespace System.Configuration public static void CallBackValidatorTestMethodNumberTwo(object o, object p) { } +#pragma warning restore xUnit1013 } } diff --git a/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs b/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs index e4aaa4ff980..139828ff9a1 100644 --- a/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs +++ b/src/libraries/System.Console/tests/CancelKeyPress.Unix.cs @@ -12,18 +12,24 @@ using Xunit; public partial class CancelKeyPressTests { + [Fact] + [ActiveIssue(39172)] [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes public void HandlerInvokedForSigInt() { HandlerInvokedForSignal(SIGINT); } + [Fact] + [ActiveIssue(39172)] [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.OSX)] // Jenkins blocks SIGQUIT on OS X, causing the test to fail in CI public void HandlerInvokedForSigQuit() { HandlerInvokedForSignal(SIGQUIT); } + [Fact] + [ActiveIssue(39172)] [PlatformSpecific(TestPlatforms.AnyUnix)] // events are triggered by Unix signals (SIGINT, SIGQUIT, SIGCHLD). public void ExitDetectionNotBlockedByHandler() { diff --git a/src/libraries/System.Console/tests/Color.cs b/src/libraries/System.Console/tests/Color.cs index 1445441af12..a9b370a066f 100644 --- a/src/libraries/System.Console/tests/Color.cs +++ b/src/libraries/System.Console/tests/Color.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; +using Microsoft.DotNet.XUnitExtensions; using Xunit; public class Color @@ -51,7 +52,8 @@ public class Color }); } - //[Fact] // the CI system redirects stdout, so we can't easily test non-redirected behavior + [Fact] + [Trait(XunitConstants.Category, XunitConstants.IgnoreForCI)] // the CI system redirects stdout, so we can't easily test non-redirected behavior [PlatformSpecific(TestPlatforms.AnyUnix)] public static void NonRedirectedOutputDoesUseAnsiSequences() { diff --git a/src/libraries/System.Console/tests/ReadAndWrite.cs b/src/libraries/System.Console/tests/ReadAndWrite.cs index 2a22e9adfe2..13b96bc73ee 100644 --- a/src/libraries/System.Console/tests/ReadAndWrite.cs +++ b/src/libraries/System.Console/tests/ReadAndWrite.cs @@ -195,7 +195,7 @@ public class ReadAndWrite } } - public static unsafe void ValidateConsoleEncoding(Encoding encoding) + private static unsafe void ValidateConsoleEncoding(Encoding encoding) { Assert.NotNull(encoding); diff --git a/src/libraries/System.Console/tests/RedirectedStream.cs b/src/libraries/System.Console/tests/RedirectedStream.cs index 31db0090979..2208554e35a 100644 --- a/src/libraries/System.Console/tests/RedirectedStream.cs +++ b/src/libraries/System.Console/tests/RedirectedStream.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using Microsoft.DotNet.RemoteExecutor; +using Microsoft.DotNet.XUnitExtensions; using Xunit; public class RedirectedStream @@ -43,14 +44,6 @@ public class RedirectedStream result = Console.IsErrorRedirected; } - //[Fact] // the CI system redirects stdout, so we can only really test the redirected behavior. - public static void CheckNonRedirectedBehavior() - { - Assert.False(Console.IsInputRedirected); - Assert.False(Console.IsOutputRedirected); - Assert.False(Console.IsErrorRedirected); - } - private static void RunRemote(Func func, ProcessStartInfo psi = null) { var options = new RemoteInvokeOptions(); diff --git a/src/libraries/System.Console/tests/WindowAndCursorProps.cs b/src/libraries/System.Console/tests/WindowAndCursorProps.cs index 52b4b382fc4..b4028688d0d 100644 --- a/src/libraries/System.Console/tests/WindowAndCursorProps.cs +++ b/src/libraries/System.Console/tests/WindowAndCursorProps.cs @@ -270,16 +270,6 @@ public class WindowAndCursorProps }, lengthOfTitle.ToString()).Dispose(); } - public static void Title_GetWindowsUap_ThrowsIOException() - { - Assert.Throws(() => Console.Title); - } - - public static void Title_SetWindowsUap_ThrowsIOException(int lengthOfTitle) - { - Assert.Throws(() => Console.Title = "x"); - } - [Fact] public static void Title_SetNull_ThrowsArgumentNullException() { diff --git a/src/libraries/System.Data.Common/tests/System/Data/ConstraintCollectionTest2.cs b/src/libraries/System.Data.Common/tests/System/Data/ConstraintCollectionTest2.cs index 8cbbd9f9147..2367f6a2a6b 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/ConstraintCollectionTest2.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/ConstraintCollectionTest2.cs @@ -399,7 +399,7 @@ namespace System.Data.Tests TestException(new testExceptionMethodCallback(DataProvider.TryToBreakForigenConstraint), arr); } - public void TestException(testExceptionMethodCallback dlg, IList exceptionList) + private static void TestException(testExceptionMethodCallback dlg, IList exceptionList) { Exception ex = Assert.ThrowsAny(() => dlg()); foreach (Exception expectedEx in exceptionList) diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataColumnCollectionTest2.cs b/src/libraries/System.Data.Common/tests/System/Data/DataColumnCollectionTest2.cs index 349bf08bf52..ea5f5a708df 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataColumnCollectionTest2.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataColumnCollectionTest2.cs @@ -326,12 +326,6 @@ namespace System.Data.Tests Assert.Equal(false, dt.Columns.Contains("String1")); Assert.Equal(true, dt.Columns.Contains("Temp1")); } - public void NotReadyTestContains_S2() // FIXME: fails in MS - { - DataTable dt = DataProvider.CreateParentDataTable(); - Assert.Equal(false, dt.Columns.Contains(null)); - } - [Fact] public void Count() diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataRowTest2.cs b/src/libraries/System.Data.Common/tests/System/Data/DataRowTest2.cs index d0fd3512c6e..61b25a0f424 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataRowTest2.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataRowTest2.cs @@ -2419,39 +2419,6 @@ namespace System.Data.Tests child.Rows[0].SetParentRow(dr); } - public void checkForLoops() - { - var ds = new DataSet(); - //Create tables - DataTable dtChild = DataProvider.CreateChildDataTable(); - DataTable dtParent = DataProvider.CreateParentDataTable(); - //Add tables to dataset - ds.Tables.Add(dtChild); - ds.Tables.Add(dtParent); - - dtChild.Rows.Clear(); - dtParent.Rows.Clear(); - - dtParent.ChildRelations.Add(dtParent.Columns[0], dtChild.Columns[0]); - dtChild.ChildRelations.Add(dtChild.Columns[0], dtParent.Columns[0]); - - dtChild.Rows[0].SetParentRow(dtParent.Rows[0]); - dtParent.Rows[0].SetParentRow(dtChild.Rows[0]); - } - - public void checkForLoopsAdvanced() - { - //Create tables - DataTable dtChild = new DataTable(); - dtChild.Columns.Add("Col1", typeof(int)); - dtChild.Columns.Add("Col2", typeof(int)); - - DataRelation drl = new DataRelation("drl1", dtChild.Columns[0], dtChild.Columns[1]); - dtChild.ChildRelations.Add(drl); - dtChild.Rows[0].SetParentRow(dtChild.Rows[1]); - dtChild.Rows[1].SetParentRow(dtChild.Rows[0]); - } - [Fact] public void SetParentRow_ByDataRowDataRelation() { diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs b/src/libraries/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs index 2604562ba35..1bcd368efe7 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs @@ -720,6 +720,7 @@ namespace System.Data.Tests Assert.Equal(2, ds.Tables[0].Columns[2].Ordinal); } + [Fact] public void TestSameParentChildName() { string xml = "" + @@ -732,6 +733,7 @@ namespace System.Data.Tests "NewDataSet", 1); } + [Fact] public void TestSameColumnName() { string xml = "" + diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataSetTest.cs b/src/libraries/System.Data.Common/tests/System/Data/DataSetTest.cs index a2b5255621a..c9552b28c70 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataSetTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataSetTest.cs @@ -669,9 +669,11 @@ namespace System.Data.Tests DataSet ds = (DataSet)ser.Deserialize(new StringReader(sw.ToString())); } + [Fact] + [ActiveIssue(39229)] public void SerializeDataSet3() { - string xml = @""; + string xml = @""; DataSet ds = new DataSet("Example"); @@ -722,8 +724,7 @@ namespace System.Data.Tests ser.Serialize(sw, ds); string result = sw.ToString(); - - Assert.Equal(xml, result); + Assert.Equal(xml, result.Replace("\r\n", "").Replace("\n", ""), ignoreCase: false, ignoreLineEndingDifferences: true, ignoreWhiteSpaceDifferences: true); } [Fact] @@ -1719,6 +1720,8 @@ namespace System.Data.Tests } #region DataSet.GetChanges Tests + [Fact] + [ActiveIssue(39171)] public void GetChanges_Relations_DifferentRowStatesTest() { DataSet ds = new DataSet("ds"); diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataTableCollectionTest2.cs b/src/libraries/System.Data.Common/tests/System/Data/DataTableCollectionTest2.cs index 669bcbde64d..308902a0f71 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataTableCollectionTest2.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataTableCollectionTest2.cs @@ -240,6 +240,8 @@ namespace System.Data.Tests } Assert.Equal(2, count); } + + [Fact] public void IndexOf_ByDataTable() { var ds = new DataSet(); @@ -257,6 +259,7 @@ namespace System.Data.Tests Assert.Equal(-1, ds.Tables.IndexOf(dt2)); } + [Fact] public void IndexOf_ByName() { var ds = new DataSet(); diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataTableLoadRowTest.cs b/src/libraries/System.Data.Common/tests/System/Data/DataTableLoadRowTest.cs index 7f4e6b6015e..9e9b984b2aa 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataTableLoadRowTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataTableLoadRowTest.cs @@ -487,7 +487,7 @@ namespace System.Data.Tests Assert.Equal(30, dt.Rows[4][0]); } - public void SubscribeEvents(DataTable dt) + private void SubscribeEvents(DataTable dt) { dt.RowChanging += new DataRowChangeEventHandler(dt_RowChanging); dt.RowChanged += new DataRowChangeEventHandler(dt_RowChanged); @@ -497,7 +497,7 @@ namespace System.Data.Tests } - public void UnsubscribeEvents(DataTable dt) + private void UnsubscribeEvents(DataTable dt) { dt.RowChanging -= new DataRowChangeEventHandler(dt_RowChanging); dt.RowChanged -= new DataRowChangeEventHandler(dt_RowChanged); @@ -506,7 +506,7 @@ namespace System.Data.Tests //dt.TableNewRow -= new DataTableNewRowEventHandler (dt_TableNewRow); } - public void ResetEventFlags() + private void ResetEventFlags() { _rowChanging = false; _rowChanged = false; diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs b/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs index 0f5409186dc..4f72f4a0018 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs @@ -2136,12 +2136,12 @@ Assert.False(true); _tableInitialized = true; } - public void OnRowChanging(object src, DataRowChangeEventArgs args) + private void OnRowChanging(object src, DataRowChangeEventArgs args) { _rowActionChanging = args.Action; } - public void OnRowChanged(object src, DataRowChangeEventArgs args) + private void OnRowChanged(object src, DataRowChangeEventArgs args) { _rowActionChanged = args.Action; } @@ -4043,8 +4043,9 @@ Assert.False(true); } [Serializable] - - public class AppDomainsAndFormatInfo { + public class AppDomainsAndFormatInfo + { + [Fact] public void Remote() { int n = (int)Convert.ChangeType("5", typeof(int)); diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataViewTest_IBindingList.cs b/src/libraries/System.Data.Common/tests/System/Data/DataViewTest_IBindingList.cs index 6098802bb1b..70eaf91e35d 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/DataViewTest_IBindingList.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/DataViewTest_IBindingList.cs @@ -101,7 +101,7 @@ namespace System.Data.Tests private ListChangedEventArgs _args = null; - public void OnListChanged(object sender, ListChangedEventArgs args) + private void OnListChanged(object sender, ListChangedEventArgs args) { _args = args; } diff --git a/src/libraries/System.Data.Common/tests/System/Data/MissingPrimaryKeyExceptionTest.cs b/src/libraries/System.Data.Common/tests/System/Data/MissingPrimaryKeyExceptionTest.cs index fbfd76cd330..8c230dda3ee 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/MissingPrimaryKeyExceptionTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/MissingPrimaryKeyExceptionTest.cs @@ -29,7 +29,7 @@ using Xunit; namespace System.Data.Tests { - internal class MissingPrimaryKeyExceptionTest + public class MissingPrimaryKeyExceptionTest { [Fact] public void Generate1() diff --git a/src/libraries/System.Data.Common/tests/System/Data/VersionNotFoundException.cs b/src/libraries/System.Data.Common/tests/System/Data/VersionNotFoundException.cs index 18e48fde946..18d21080de7 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/VersionNotFoundException.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/VersionNotFoundException.cs @@ -29,7 +29,7 @@ using Xunit; namespace System.Data.Tests { - internal class VersionNotFoundExceptionTest + public class VersionNotFoundExceptionTest { [Fact] public void Generate1() diff --git a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/PoolBlockPeriodTest.netcoreapp.cs b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/PoolBlockPeriodTest.netcoreapp.cs index 45e0793e176..f7f270122f4 100644 --- a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/PoolBlockPeriodTest.netcoreapp.cs +++ b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/PoolBlockPeriodTest.netcoreapp.cs @@ -92,7 +92,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests PoolBlockingPeriodAzureTest(connString, policy); } - public void PoolBlockingPeriodNonAzureTest(string connStr, PoolBlockingPeriod? policy) + private void PoolBlockingPeriodNonAzureTest(string connStr, PoolBlockingPeriod? policy) { int firstErrorTimeInSecs = GetConnectionOpenTimeInSeconds(connStr); int secondErrorTimeInSecs = GetConnectionOpenTimeInSeconds(connStr); @@ -108,7 +108,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests } } - public void PoolBlockingPeriodAzureTest(string connStr, PoolBlockingPeriod? policy) + private void PoolBlockingPeriodAzureTest(string connStr, PoolBlockingPeriod? policy) { int firstErrorTimeInSecs = GetConnectionOpenTimeInSeconds(connStr); int secondErrorTimeInSecs = GetConnectionOpenTimeInSeconds(connStr); diff --git a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs index ad5919b696d..35e5a24fa99 100644 --- a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs +++ b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs @@ -37,7 +37,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests TryOpenConnectionWithIntegratedAuthentication(builder.ConnectionString); } - public static void TryOpenConnectionWithIntegratedAuthentication(string connectionString) + private static void TryOpenConnectionWithIntegratedAuthentication(string connectionString) { using (SqlConnection connection = new SqlConnection(connectionString)) { diff --git a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlAdapterUpdateBatch.cs b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlAdapterUpdateBatch.cs index e3c4aaf2d74..584a04f6b05 100644 --- a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlAdapterUpdateBatch.cs +++ b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/SqlAdapterUpdateBatch.cs @@ -47,7 +47,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests } - public class EventInfo + private class EventInfo { public string Level { get; set; } public string Message { get; set; } @@ -59,7 +59,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests } } - public static void ExecuteNonQueries() + private static void ExecuteNonQueries() { List entities = new List { diff --git a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs index 174247af249..a46588d8c3f 100644 --- a/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs +++ b/src/libraries/System.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs @@ -342,7 +342,7 @@ namespace System.Data.SqlClient.ManualTesting.Tests } } - public void QueryHintsTest() + private void QueryHintsTest() { using (SqlConnection conn = new SqlConnection(_connStr)) { diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs index 8de24818ea6..e72664e528e 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs @@ -657,7 +657,7 @@ namespace System.Diagnostics.Tests } - public void CleanUp() + private void CleanUp() { Activity.DefaultIdFormat = ActivityIdFormat.Hierarchical; Activity.ForceDefaultIdFormat = false; diff --git a/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogEntryWrittenTest.cs b/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogEntryWrittenTest.cs index 68337295d25..21609b7efac 100644 --- a/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogEntryWrittenTest.cs +++ b/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogEntryWrittenTest.cs @@ -13,7 +13,7 @@ namespace System.Diagnostics.Tests private const string message = "EventLogEntryEventWrittenTestMessage"; private int eventCounter; - public void RaisingEvent(string log, string methodName, bool waitOnEvent = true) + private void RaisingEvent(string log, string methodName, bool waitOnEvent = true) { signal = new AutoResetEvent(false); eventCounter = 0; diff --git a/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs b/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs index 87da042b5df..2e7f755cf3b 100644 --- a/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs +++ b/src/libraries/System.Diagnostics.EventLog/tests/EventLogTests/EventLogWriteEntryTests.cs @@ -275,7 +275,7 @@ namespace System.Diagnostics.Tests } } - [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] + [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void WriteEntryWithoutSource() { using (EventLog eventLog = new EventLog()) @@ -284,7 +284,7 @@ namespace System.Diagnostics.Tests } } - [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] + [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void WriteEntryWithInvalidType() { using (EventLog eventLog = new EventLog()) @@ -295,7 +295,7 @@ namespace System.Diagnostics.Tests } } - [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] + [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void WriteEntryWithNullOrEmptySource() { Assert.Throws(() => EventLog.WriteEntry(null, message)); @@ -355,20 +355,20 @@ namespace System.Diagnostics.Tests } } - [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] + [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void WriteEventInstanceNull() { string source = "Source_" + nameof(WriteEventInstanceNull); - Assert.Throws(() => Helpers.RetryOnWin7(() => EventLog.WriteEvent(source, null, insertStrings))); + Helpers.RetryOnWin7(() => Assert.Throws(() => EventLog.WriteEvent(source, null, insertStrings))); } - [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] + [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void WriteEventMessageValues_OutOfRange() { string source = "Source_" + nameof(WriteEventMessageValues_OutOfRange); string[] message = new string[1]; message[0] = new string('c', 32767); - Assert.Throws(() => Helpers.RetryOnWin7(() => EventLog.WriteEvent(source, eventInstance, message))); + Helpers.RetryOnWin7(() => Assert.Throws(() => EventLog.WriteEvent(source, eventInstance, message))); } [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] @@ -386,7 +386,7 @@ namespace System.Diagnostics.Tests } } - [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] + [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void SourceNameMaxLengthExceeded() { string source = new string('s', 254); diff --git a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogWatcherTests.cs b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogWatcherTests.cs index c7aa79e26ac..e676955ce5a 100644 --- a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogWatcherTests.cs +++ b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogWatcherTests.cs @@ -59,7 +59,7 @@ namespace System.Diagnostics.Tests return bookmark; } - public void RaisingEvent(string log, string methodName, bool waitOnEvent = true) + private void RaisingEvent(string log, string methodName, bool waitOnEvent = true) { signal = new AutoResetEvent(false); eventCounter = 0; diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 525c5b29557..c71cc5ff356 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -1342,16 +1342,6 @@ namespace System.Diagnostics.Tests Assert.Throws(() => process.StandardInput); } - // [Fact] // uncomment for diagnostic purposes to list processes to console - public void TestDiagnosticsWithConsoleWriteLine() - { - foreach (var p in Process.GetProcesses().OrderBy(p => p.Id)) - { - Console.WriteLine("{0} : \"{1}\" (Threads: {2})", p.Id, p.ProcessName, p.Threads.Count); - p.Dispose(); - } - } - [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "GC has different behavior on Mono")] public void CanBeFinalized() diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/ReferralCallbackTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/ReferralCallbackTests.cs index e2013c57270..cc6a1e93aba 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/ReferralCallbackTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/ReferralCallbackTests.cs @@ -39,8 +39,8 @@ namespace System.DirectoryServices.Protocols.Tests Assert.Equal(QueryForConnection, callback.QueryForConnection); } - public static void DereferenceConnection(LdapConnection primaryConnection, LdapConnection connectionToDereference) { } - public static bool NotifyNewConnection(LdapConnection primaryConnection, LdapConnection referralFromConnection, string newDistinguishedName, LdapDirectoryIdentifier identifier, LdapConnection newConnection, NetworkCredential credential, long currentUserToken, int errorCodeFromBind) => true; - public static LdapConnection QueryForConnection(LdapConnection primaryConnection, LdapConnection referralFromConnection, string newDistinguishedName, LdapDirectoryIdentifier identifier, NetworkCredential credential, long currentUserToken) => null; + internal static void DereferenceConnection(LdapConnection primaryConnection, LdapConnection connectionToDereference) { } + internal static bool NotifyNewConnection(LdapConnection primaryConnection, LdapConnection referralFromConnection, string newDistinguishedName, LdapDirectoryIdentifier identifier, LdapConnection newConnection, NetworkCredential credential, long currentUserToken, int errorCodeFromBind) => true; + internal static LdapConnection QueryForConnection(LdapConnection primaryConnection, LdapConnection referralFromConnection, string newDistinguishedName, LdapDirectoryIdentifier identifier, NetworkCredential credential, long currentUserToken) => null; } } diff --git a/src/libraries/System.Drawing.Common/tests/BrushTests.cs b/src/libraries/System.Drawing.Common/tests/BrushTests.cs index 7ebf4bd8014..c4fba4c1df2 100644 --- a/src/libraries/System.Drawing.Common/tests/BrushTests.cs +++ b/src/libraries/System.Drawing.Common/tests/BrushTests.cs @@ -20,7 +20,8 @@ namespace System.Drawing.Tests } } - [ConditionalTheory(Helpers.IsDrawingSupported)] + [ActiveIssue(39232)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void Dispose_NoSuchEntryPoint_SilentyCatchesException() { var brush = new SubBrush(); diff --git a/src/libraries/System.Drawing.Common/tests/ColorTranslatorTests.cs b/src/libraries/System.Drawing.Common/tests/ColorTranslatorTests.cs index 38384375ea8..438f4d72275 100644 --- a/src/libraries/System.Drawing.Common/tests/ColorTranslatorTests.cs +++ b/src/libraries/System.Drawing.Common/tests/ColorTranslatorTests.cs @@ -220,6 +220,7 @@ namespace System.Drawing.Tests } } + [ConditionalTheory(Helpers.IsDrawingSupported)] [InlineData("#G12", typeof(FormatException))] [InlineData("#G12345", typeof(FormatException))] [InlineData("1,2", typeof(ArgumentException))] @@ -230,7 +231,6 @@ namespace System.Drawing.Tests [InlineData("1,256,3", typeof(ArgumentException))] [InlineData("1,2,-1", typeof(ArgumentException))] [InlineData("1,2,256", typeof(ArgumentException))] - public void FromHtml_Invalid_Throw(string htmlColor, Type exception) { using (new ThreadCultureChange(CultureInfo.InvariantCulture)) diff --git a/src/libraries/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs b/src/libraries/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs index 11ae6e0452f..bf4b39aac7b 100644 --- a/src/libraries/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs +++ b/src/libraries/System.Drawing.Common/tests/Drawing2D/CustomLineCapTests.cs @@ -169,6 +169,7 @@ namespace System.Drawing.Drawing2D.Tests } } + [ConditionalTheory(Helpers.IsDrawingSupported)] [InlineData(LineCap.NoAnchor)] [InlineData(LineCap.SquareAnchor)] [InlineData(LineCap.RoundAnchor)] @@ -176,6 +177,7 @@ namespace System.Drawing.Drawing2D.Tests [InlineData(LineCap.Custom)] [InlineData(LineCap.Flat - 1)] [InlineData(LineCap.Custom + 1)] + [ActiveIssue(20884)] public void BaseCap_Set_InvalidLineCap_ThrowsArgumentException(LineCap baseCap) { using (GraphicsPath strokePath = new GraphicsPath()) diff --git a/src/libraries/System.Drawing.Common/tests/FontTests.cs b/src/libraries/System.Drawing.Common/tests/FontTests.cs index 991ba0ed6d9..c6e9b751d5e 100644 --- a/src/libraries/System.Drawing.Common/tests/FontTests.cs +++ b/src/libraries/System.Drawing.Common/tests/FontTests.cs @@ -593,8 +593,8 @@ namespace System.Drawing.Tests } } - // This causes an AccessViolation in GDI+. - // [ConditionalFact(Helpers.GdiplusIsAvailable)] + [ConditionalFact(Helpers.IsDrawingSupported)] + [ActiveIssue(22571)] // PR issue, This causes an AccessViolation in GDI+. public void GetHeight_DisposedGraphics_ThrowsArgumentException() { using (FontFamily family = FontFamily.GenericMonospace) diff --git a/src/libraries/System.Drawing.Common/tests/Imaging/ImageAttributesTests.cs b/src/libraries/System.Drawing.Common/tests/Imaging/ImageAttributesTests.cs index ae329add40f..1a3b7e3a30f 100644 --- a/src/libraries/System.Drawing.Common/tests/Imaging/ImageAttributesTests.cs +++ b/src/libraries/System.Drawing.Common/tests/Imaging/ImageAttributesTests.cs @@ -551,6 +551,7 @@ namespace System.Drawing.Imaging.Tests } } + [ConditionalTheory(Helpers.IsDrawingSupported)] [ActiveIssue(20884, TestPlatforms.AnyUnix)] [MemberData(nameof(ColorAdjustTypeI_TestData))] public void SetThreshold_ThresholdTypeI_Success(ColorAdjustType type) @@ -587,6 +588,8 @@ namespace System.Drawing.Imaging.Tests } } + [ActiveIssue(20884, TestPlatforms.AnyUnix)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void ClearThreshold_Success() { using (var bitmap = new Bitmap(_rectangle.Width, _rectangle.Height)) diff --git a/src/libraries/System.Drawing.Common/tests/Imaging/MetafileTests.cs b/src/libraries/System.Drawing.Common/tests/Imaging/MetafileTests.cs index affe0c1d1cf..2cc526a691d 100644 --- a/src/libraries/System.Drawing.Common/tests/Imaging/MetafileTests.cs +++ b/src/libraries/System.Drawing.Common/tests/Imaging/MetafileTests.cs @@ -495,7 +495,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(Helpers.IsDrawingSupported)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void Ctor_StringIntPtrRectangleF_Success() { string fileName = GetPath("newTestImage.wmf"); @@ -579,7 +579,7 @@ namespace System.Drawing.Imaging.Tests File.Delete(fileName); } - [ConditionalTheory(Helpers.IsDrawingSupported)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void Ctor_StringIntPtrRectangle_Success() { string fileName = GetPath("newTestImage.wmf"); @@ -788,7 +788,7 @@ namespace System.Drawing.Imaging.Tests } } - [ConditionalTheory(Helpers.IsDrawingSupported)] + [ConditionalFact(Helpers.IsDrawingSupported)] public void Ctor_StreamIntPtrRectangle_Success() { using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb)) diff --git a/src/libraries/System.Drawing.Common/tests/Printing/PrintDocumentTests.cs b/src/libraries/System.Drawing.Common/tests/Printing/PrintDocumentTests.cs index ab6a7c3dc5a..561e347b1f9 100644 --- a/src/libraries/System.Drawing.Common/tests/Printing/PrintDocumentTests.cs +++ b/src/libraries/System.Drawing.Common/tests/Printing/PrintDocumentTests.cs @@ -63,6 +63,7 @@ namespace System.Drawing.Printing.Tests } } + [Fact] [ActiveIssue(20884, TestPlatforms.AnyUnix)] public void DefaultPageSettings_Null_ReturnsExpected() { diff --git a/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs b/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs index 08db17aca82..a7f989d3fc9 100644 --- a/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs +++ b/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/BitmapTests.cs @@ -64,6 +64,7 @@ namespace MonoTests.System.Drawing Assert.Equal(Color.FromArgb(255, 255, 0, 155), color2); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20884)] public void LockBits_IndexedWrite_NonIndexed() { @@ -74,6 +75,7 @@ namespace MonoTests.System.Drawing } } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20884)] public void LockBits_NonIndexedWrite_ToIndexed() { @@ -295,6 +297,7 @@ namespace MonoTests.System.Drawing FormatTest(PixelFormat.Format32bppArgb); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20884)] public void Format32bppRgb() { @@ -669,6 +672,7 @@ namespace MonoTests.System.Drawing } } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20884)] public void LockBitmap_Format32bppArgb_Format32bppRgb_ReadWrite_Whole() { @@ -723,6 +727,7 @@ namespace MonoTests.System.Drawing } } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20884)] public void LockBitmap_Format32bppArgb_Format32bppRgb_ReadWrite_Partial() { @@ -911,6 +916,7 @@ namespace MonoTests.System.Drawing return new BinaryFormatter().Deserialize(s); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844)] public void Serialize_Icon() { diff --git a/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs b/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs index f9ffed2b579..0240355ca8b 100644 --- a/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs +++ b/src/libraries/System.Drawing.Common/tests/mono/System.Drawing/GraphicsTests.cs @@ -1891,6 +1891,7 @@ namespace MonoTests.System.Drawing } } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844)] public void MeasureString_MultlineString_Width() { @@ -2808,18 +2809,21 @@ namespace MonoTests.System.Drawing Assert.Throws(() => DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit.Display)); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844, TestPlatforms.Any)] public void DrawImage_ImageRectangleRectangleGraphicsUnit_Document() { Assert.Throws(() => DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit.Document)); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844)] public void DrawImage_ImageRectangleRectangleGraphicsUnit_Inch() { Assert.Throws(() => DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit.Inch)); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844, TestPlatforms.Any)] public void DrawImage_ImageRectangleRectangleGraphicsUnit_Millimeter() { @@ -2833,6 +2837,7 @@ namespace MonoTests.System.Drawing DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit.Pixel); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844, TestPlatforms.Any)] public void DrawImage_ImageRectangleRectangleGraphicsUnit_Point() { diff --git a/src/libraries/System.Drawing.Common/tests/mono/System.Imaging/MetafileTest.cs b/src/libraries/System.Drawing.Common/tests/mono/System.Imaging/MetafileTest.cs index 0ad321655ee..c23727981bd 100644 --- a/src/libraries/System.Drawing.Common/tests/mono/System.Imaging/MetafileTest.cs +++ b/src/libraries/System.Drawing.Common/tests/mono/System.Imaging/MetafileTest.cs @@ -56,7 +56,7 @@ namespace MonoTests.System.Drawing.Imaging } } - static public void Check_MetaHeader_WmfPlaceable(MetaHeader mh) + private static void Check_MetaHeader_WmfPlaceable(MetaHeader mh) { Assert.Equal(9, mh.HeaderSize); Assert.Equal(98, mh.MaxRecord); @@ -67,7 +67,7 @@ namespace MonoTests.System.Drawing.Imaging Assert.Equal(0x300, mh.Version); } - public static void Check_MetafileHeader_WmfPlaceable(MetafileHeader header) + private static void Check_MetafileHeader_WmfPlaceable(MetafileHeader header) { Assert.Equal(MetafileType.WmfPlaceable, header.Type); Assert.Equal(0x300, header.Version); @@ -148,7 +148,7 @@ namespace MonoTests.System.Drawing.Imaging } } - public static void Check_MetafileHeader_Emf(MetafileHeader header) + private static void Check_MetafileHeader_Emf(MetafileHeader header) { Assert.Equal(MetafileType.Emf, header.Type); Assert.Equal(65536, header.Version); @@ -371,18 +371,21 @@ namespace MonoTests.System.Drawing.Imaging } } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844)] public void CreateFilename_SingleGraphics_EmfOnly() { CreateFilename(EmfType.EmfOnly, true); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844)] public void CreateFilename_SingleGraphics_EmfPlusDual() { CreateFilename(EmfType.EmfPlusDual, true); } + [ConditionalFact(Helpers.IsDrawingSupported)] [ActiveIssue(20844)] public void CreateFilename_SingleGraphics_EmfPlusOnly() { diff --git a/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj b/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj index b15be1ae67c..5330177b941 100644 --- a/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj +++ b/src/libraries/System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj @@ -3,6 +3,8 @@ {0BFD6D9F-DF9E-4B17-8ED4-29437AE5B04A} true 67,168,219,414,162,184,458,464,78,169,114,693,108,1981,649,109,1066,3021,3026,3002,3014,3022,660,661,429 + + true netcoreapp-Debug;netcoreapp-Release;uap-Debug;uap-Release diff --git a/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetAsciiTests.cs b/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetAsciiTests.cs index c2d7e791c66..ad77dadf0c1 100644 --- a/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetAsciiTests.cs +++ b/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetAsciiTests.cs @@ -168,7 +168,7 @@ namespace System.Globalization.Tests GetAscii_Invalid(new IdnMapping() { UseStd3AsciiRules = true }, unicode, index, count, exceptionType); } - public static void GetAscii_Invalid(IdnMapping idnMapping, string unicode, int index, int count, Type exceptionType) + private static void GetAscii_Invalid(IdnMapping idnMapping, string unicode, int index, int count, Type exceptionType) { if (unicode == null || index + count == unicode.Length) { diff --git a/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetUnicodeTests.cs b/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetUnicodeTests.cs index 3022b3a869a..c858aa128b2 100644 --- a/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetUnicodeTests.cs +++ b/src/libraries/System.Globalization.Extensions/tests/IdnMapping/IdnMappingGetUnicodeTests.cs @@ -111,7 +111,7 @@ namespace System.Globalization.Tests GetUnicode_Invalid(new IdnMapping() { UseStd3AsciiRules = true }, ascii, index, count, exceptionType); } - public static void GetUnicode_Invalid(IdnMapping idnMapping, string ascii, int index, int count, Type exceptionType) + private static void GetUnicode_Invalid(IdnMapping idnMapping, string ascii, int index, int count, Type exceptionType) { if (ascii == null || index + count == ascii.Length) { diff --git a/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs b/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs index 9133071e282..4b7aa75f2dc 100644 --- a/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs +++ b/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs @@ -178,7 +178,7 @@ namespace System.Globalization.Tests Assert.Equal(expected, compareInfo.IndexOf(source, value, startIndex, count, options)); } - public void IndexOf_Char(CompareInfo compareInfo, string source, char value, int startIndex, int count, CompareOptions options, int expected) + private static void IndexOf_Char(CompareInfo compareInfo, string source, char value, int startIndex, int count, CompareOptions options, int expected) { if (options == CompareOptions.None) { diff --git a/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.LastIndexOf.cs b/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.LastIndexOf.cs index 57cffe231b9..1ec5cfca3c1 100644 --- a/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.LastIndexOf.cs +++ b/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.LastIndexOf.cs @@ -151,7 +151,7 @@ namespace System.Globalization.Tests Assert.Equal(expected, compareInfo.LastIndexOf(source, value, startIndex, count, options)); } - public void LastIndexOf_Char(CompareInfo compareInfo, string source, char value, int startIndex, int count, CompareOptions options, int expected) + private static void LastIndexOf_Char(CompareInfo compareInfo, string source, char value, int startIndex, int count, CompareOptions options, int expected) { if (options == CompareOptions.None) { diff --git a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs index 5c1d104e6b8..1421a998c30 100644 --- a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs +++ b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs @@ -9,6 +9,7 @@ namespace System.Globalization.Tests { public class DateTimeFormatInfoLongTimePattern { + [Fact] public void LongTimePattern_GetInvariantInfo_ReturnsExpected() { Assert.Equal("HH:mm:ss", DateTimeFormatInfo.InvariantInfo.LongTimePattern); diff --git a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoMonthDayPattern.cs b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoMonthDayPattern.cs index e3ae09a5b65..88c4dbe44c4 100644 --- a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoMonthDayPattern.cs +++ b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoMonthDayPattern.cs @@ -9,6 +9,7 @@ namespace System.Globalization.Tests { public class DateTimeFormatInfoMonthDayPattern { + [Fact] public void LongDayPattern_GetInvariantInfo_ReturnsExpected() { Assert.Equal("MMMM dd", DateTimeFormatInfo.InvariantInfo.MonthDayPattern); diff --git a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs index 7a1dc78b68a..4e67e1dcc7b 100644 --- a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs +++ b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs @@ -9,6 +9,7 @@ namespace System.Globalization.Tests { public class DateTimeFormatInfoShortDatePattern { + [Fact] public void ShortDatePattern_InvariantInfo() { Assert.Equal("MM/dd/yyyy", DateTimeFormatInfo.InvariantInfo.ShortDatePattern); diff --git a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs index 84a3d693136..bcea88b7452 100644 --- a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs +++ b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs @@ -9,6 +9,7 @@ namespace System.Globalization.Tests { public class DateTimeFormatInfoShortTimePattern { + [Fact] public void ShortTimePattern_GetInvariantInfo_ReturnsExpected() { Assert.Equal("HH:mm", DateTimeFormatInfo.InvariantInfo.ShortTimePattern); diff --git a/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs b/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs index 4c311ab39e2..bddbc8b3ec9 100644 --- a/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs +++ b/src/libraries/System.Globalization/tests/System/Globalization/TextInfoTests.cs @@ -80,7 +80,6 @@ namespace System.Globalization.Tests Assert.Equal(expected, ti.ToTitleCase(actual)); } - [Theory] public static IEnumerable CultureName_TestData() { yield return new object[] { CultureInfo.InvariantCulture.TextInfo, "" }; @@ -246,7 +245,7 @@ namespace System.Globalization.Tests } } - public void TestToLower(string name, string str, string expected) + private static void TestToLower(string name, string str, string expected) { Assert.Equal(expected, new CultureInfo(name).TextInfo.ToLower(str)); if (str.Length == 1) @@ -369,7 +368,7 @@ namespace System.Globalization.Tests } } - public void TestToUpper(string name, string str, string expected) + private static void TestToUpper(string name, string str, string expected) { Assert.Equal(expected, new CultureInfo(name).TextInfo.ToUpper(str)); if (str.Length == 1) diff --git a/src/libraries/System.IO.Compression.Brotli/tests/BrotliEncoderTests.cs b/src/libraries/System.IO.Compression.Brotli/tests/BrotliEncoderTests.cs index f019234c661..f4026d5f09f 100644 --- a/src/libraries/System.IO.Compression.Brotli/tests/BrotliEncoderTests.cs +++ b/src/libraries/System.IO.Compression.Brotli/tests/BrotliEncoderTests.cs @@ -352,7 +352,7 @@ namespace System.IO.Compression.Tests Assert.Equal(correctUncompressedBytes, decompressedBytes); } - public static void Compress_WithState(ReadOnlySpan input, Span output) + private static void Compress_WithState(ReadOnlySpan input, Span output) { BrotliEncoder encoder; while (!input.IsEmpty && !output.IsEmpty) @@ -364,7 +364,7 @@ namespace System.IO.Compression.Tests encoder.Compress(ReadOnlySpan.Empty, output, out int bytesConsumed2, out int bytesWritten, isFinalBlock: true); } - public static void Decompress_WithState(ReadOnlySpan input, Span output) + private static void Decompress_WithState(ReadOnlySpan input, Span output) { BrotliDecoder decoder; while (!input.IsEmpty && !output.IsEmpty) @@ -375,17 +375,17 @@ namespace System.IO.Compression.Tests } } - public static void Compress_WithoutState(ReadOnlySpan input, Span output) + private static void Compress_WithoutState(ReadOnlySpan input, Span output) { BrotliEncoder.TryCompress(input, output, out int bytesWritten); } - public static void Decompress_WithoutState(ReadOnlySpan input, Span output) + private static void Decompress_WithoutState(ReadOnlySpan input, Span output) { BrotliDecoder.TryDecompress(input, output, out int bytesWritten); } - public static MemoryStream Compress_Stream(ReadOnlySpan input, CompressionLevel compressionLevel) + private static MemoryStream Compress_Stream(ReadOnlySpan input, CompressionLevel compressionLevel) { using (var inputStream = new MemoryStream(input.ToArray())) { @@ -397,7 +397,7 @@ namespace System.IO.Compression.Tests } } - public static MemoryStream Decompress_Stream(ReadOnlySpan input) + private static MemoryStream Decompress_Stream(ReadOnlySpan input) { using (var inputStream = new MemoryStream(input.ToArray())) { diff --git a/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs b/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs index 23fa47b2e67..18f8deba4af 100644 --- a/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs +++ b/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs @@ -44,6 +44,7 @@ namespace System.IO.Compression.Tests } } + [Theory] [InlineData("normal")] [InlineData("empty")] [InlineData("unicode")] diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs index 7383545d91d..58990072999 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.WaitForChanged.cs @@ -64,7 +64,7 @@ namespace System.IO.Tests Assert.Equal(name, result.OldName); } - [Theory] + [Fact] public static void WaitForChangedResult_TimedOut_Roundtrip() { var result = new WaitForChangedResult(); diff --git a/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs index 717cb9f71cf..b85cae653b6 100644 --- a/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/Base/BaseGetSetTimes.cs @@ -19,10 +19,10 @@ namespace System.IO.Tests protected static bool isHFS => driveFormat != null && driveFormat.Equals(HFS, StringComparison.InvariantCultureIgnoreCase); protected static bool isNotHFS => !isHFS; - public abstract T GetExistingItem(); - public abstract T GetMissingItem(); + protected abstract T GetExistingItem(); + protected abstract T GetMissingItem(); - public abstract string GetItemPath(T item); + protected abstract string GetItemPath(T item); public abstract IEnumerable TimeFunctions(bool requiresRoundtripping = false); diff --git a/src/libraries/System.IO.FileSystem/tests/Base/InfoGetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/Base/InfoGetSetTimes.cs index adff56c6737..a0b9e3e423d 100644 --- a/src/libraries/System.IO.FileSystem/tests/Base/InfoGetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/Base/InfoGetSetTimes.cs @@ -10,8 +10,10 @@ namespace System.IO.Tests { public abstract class InfoGetSetTimes : BaseGetSetTimes where T : FileSystemInfo { - public abstract void InvokeCreate(T item); + protected abstract void InvokeCreate(T item); + [Fact] + [ActiveIssue(39108)] public void DoesntExistThenCreate_ReturnsDefaultValues() { T item = GetMissingItem(); @@ -27,6 +29,7 @@ namespace System.IO.Tests }); } + [Fact] public void ExistsThenDelete_ReturnsDefaultValues() { // Because we haven't hit the property the item should be in diff --git a/src/libraries/System.IO.FileSystem/tests/Base/StaticGetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/Base/StaticGetSetTimes.cs index 12ee8997fd3..ab6e25013e2 100644 --- a/src/libraries/System.IO.FileSystem/tests/Base/StaticGetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/Base/StaticGetSetTimes.cs @@ -8,9 +8,9 @@ namespace System.IO.Tests { public abstract class StaticGetSetTimes : BaseGetSetTimes { - public override string GetMissingItem() => GetTestFilePath(); + protected override string GetMissingItem() => GetTestFilePath(); - public override string GetItemPath(string item) => item; + protected override string GetItemPath(string item) => item; [Fact] public void NullPath_ThrowsArgumentNullException() diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/Delete.cs b/src/libraries/System.IO.FileSystem/tests/Directory/Delete.cs index d655369e143..78f881bd5b9 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/Delete.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/Delete.cs @@ -15,7 +15,7 @@ namespace System.IO.Tests #region Utilities - public virtual void Delete(string path) + protected virtual void Delete(string path) { Directory.Delete(path); } @@ -223,12 +223,12 @@ namespace System.IO.Tests { #region Utilities - public override void Delete(string path) + protected override void Delete(string path) { Directory.Delete(path, false); } - public virtual void Delete(string path, bool recursive) + protected virtual void Delete(string path, bool recursive) { Directory.Delete(path, recursive); } diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs index c6e0d7f4038..8b3c18af70f 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/GetSetTimes.cs @@ -8,7 +8,7 @@ namespace System.IO.Tests { public class Directory_GetSetTimes : StaticGetSetTimes { - public override string GetExistingItem() => Directory.CreateDirectory(GetTestFilePath()).FullName; + protected override string GetExistingItem() => Directory.CreateDirectory(GetTestFilePath()).FullName; public override IEnumerable TimeFunctions(bool requiresRoundtripping = false) { diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs b/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs index 7b513d9e4cb..5b1c6a9d4d2 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/Move.cs @@ -10,7 +10,7 @@ namespace System.IO.Tests { #region Utilities - public virtual void Move(string sourceDir, string destDir) + protected virtual void Move(string sourceDir, string destDir) { Directory.Move(sourceDir, destDir); } diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Delete.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Delete.cs index c40162d2dde..09082d1553f 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Delete.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/Delete.cs @@ -8,7 +8,7 @@ namespace System.IO.Tests { public class DirectoryInfo_Delete : Directory_Delete_str { - public override void Delete(string path) + protected override void Delete(string path) { new DirectoryInfo(path).Delete(); } @@ -30,12 +30,12 @@ namespace System.IO.Tests public class DirectoryInfo_Delete_bool : Directory_Delete_str_bool { - public override void Delete(string path) + protected override void Delete(string path) { new DirectoryInfo(path).Delete(false); } - public override void Delete(string path, bool recursive) + protected override void Delete(string path, bool recursive) { new DirectoryInfo(path).Delete(recursive); } diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs index 779be70df6b..dd3e38bad1c 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetTimes.cs @@ -8,13 +8,13 @@ namespace System.IO.Tests { public class DirectoryInfo_GetSetTimes : InfoGetSetTimes { - public override DirectoryInfo GetExistingItem() => Directory.CreateDirectory(GetTestFilePath()); + protected override DirectoryInfo GetExistingItem() => Directory.CreateDirectory(GetTestFilePath()); - public override DirectoryInfo GetMissingItem() => new DirectoryInfo(GetTestFilePath()); + protected override DirectoryInfo GetMissingItem() => new DirectoryInfo(GetTestFilePath()); - public override string GetItemPath(DirectoryInfo item) => item.FullName; + protected override string GetItemPath(DirectoryInfo item) => item.FullName; - public override void InvokeCreate(DirectoryInfo item) => item.Create(); + protected override void InvokeCreate(DirectoryInfo item) => item.Create(); public override IEnumerable TimeFunctions(bool requiresRoundtripping = false) { diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs index 12393b0e6cb..8f80fc697a3 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/MoveTo.cs @@ -10,12 +10,12 @@ namespace System.IO.Tests { #region Utilities - public override void Move(string sourceDir, string destDir) + protected override void Move(string sourceDir, string destDir) { new DirectoryInfo(sourceDir).MoveTo(destDir); } - public virtual void Move(DirectoryInfo sourceDir, string destDir) + protected virtual void Move(DirectoryInfo sourceDir, string destDir) { sourceDir.MoveTo(destDir); } diff --git a/src/libraries/System.IO.FileSystem/tests/File/Copy.cs b/src/libraries/System.IO.FileSystem/tests/File/Copy.cs index af0a4b692c0..0796425d1b2 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/Copy.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/Copy.cs @@ -10,7 +10,7 @@ namespace System.IO.Tests { public partial class File_Copy_str_str : FileSystemTest { - public virtual void Copy(string source, string dest) + protected virtual void Copy(string source, string dest) { File.Copy(source, dest); } @@ -237,12 +237,12 @@ namespace System.IO.Tests public class File_Copy_str_str_b : File_Copy_str_str { - public override void Copy(string source, string dest) + protected override void Copy(string source, string dest) { File.Copy(source, dest, false); } - public virtual void Copy(string source, string dest, bool overwrite) + protected virtual void Copy(string source, string dest, bool overwrite) { File.Copy(source, dest, overwrite); } diff --git a/src/libraries/System.IO.FileSystem/tests/File/Delete.cs b/src/libraries/System.IO.FileSystem/tests/File/Delete.cs index 4a82eb1fc76..59fe51b895c 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/Delete.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/Delete.cs @@ -12,12 +12,12 @@ namespace System.IO.Tests { static bool IsBindMountSupported => RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && !PlatformDetection.IsInContainer && !PlatformDetection.IsRedHatFamily6; - public virtual void Delete(string path) + protected virtual void Delete(string path) { File.Delete(path); } - public virtual FileInfo Create(string path) + protected virtual FileInfo Create(string path) { var ret = new FileInfo(path); ret.Create().Dispose(); diff --git a/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs index e5148468843..6af7d99eb35 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/GetSetTimes.cs @@ -16,7 +16,7 @@ namespace System.IO.Tests // 32bit Unix has time_t up to ~ 2038. private static bool SupportsLongMaxDateTime => PlatformDetection.IsWindows || (RuntimeInformation.ProcessArchitecture != Architecture.Arm && RuntimeInformation.ProcessArchitecture != Architecture.X86 && !PlatformDetection.IsOSX); - public override string GetExistingItem() + protected override string GetExistingItem() { string path = GetTestFilePath(); File.Create(path).Dispose(); diff --git a/src/libraries/System.IO.FileSystem/tests/File/Move.cs b/src/libraries/System.IO.FileSystem/tests/File/Move.cs index 16f4f9c8134..8361e355fea 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/Move.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/Move.cs @@ -11,7 +11,7 @@ namespace System.IO.Tests { #region Utilities - public virtual void Move(string sourceFile, string destFile) + protected virtual void Move(string sourceFile, string destFile) { File.Move(sourceFile, destFile); } diff --git a/src/libraries/System.IO.FileSystem/tests/File/Move.netcoreapp.cs b/src/libraries/System.IO.FileSystem/tests/File/Move.netcoreapp.cs index 26231d06582..b9c8201db88 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/Move.netcoreapp.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/Move.netcoreapp.cs @@ -11,7 +11,7 @@ namespace System.IO.Tests { #region Utilities - public virtual void Move(string sourceFile, string destFile, bool overwrite) + protected virtual void Move(string sourceFile, string destFile, bool overwrite) { File.Move(sourceFile, destFile, overwrite); } diff --git a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs index b92e5201bd6..769821021b7 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytes.cs @@ -153,7 +153,7 @@ namespace System.IO.Tests } } - [Theory] + [Fact] [PlatformSpecific(TestPlatforms.Linux)] public void ReadAllBytes_ProcFs_Uptime_ContainsTwoNumbers() { diff --git a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs index fa2a8faa7f2..0f844a5b084 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/ReadWriteAllBytesAsync.cs @@ -166,7 +166,7 @@ namespace System.IO.Tests } } - [Theory] + [Fact] [PlatformSpecific(TestPlatforms.Linux)] public async Task ReadAllBytes_ProcFs_Uptime_ContainsTwoNumbers() { diff --git a/src/libraries/System.IO.FileSystem/tests/File/Replace.cs b/src/libraries/System.IO.FileSystem/tests/File/Replace.cs index 3bc374a6342..891f765a780 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/Replace.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/Replace.cs @@ -10,12 +10,12 @@ namespace System.IO.Tests { #region Utilities - public virtual void Replace(string source, string dest, string destBackup) + protected virtual void Replace(string source, string dest, string destBackup) { File.Replace(source, dest, destBackup); } - public virtual void Replace(string source, string dest, string destBackup, bool ignoreMetadataErrors) + protected virtual void Replace(string source, string dest, string destBackup, bool ignoreMetadataErrors) { File.Replace(source, dest, destBackup, ignoreMetadataErrors); } @@ -117,7 +117,7 @@ namespace System.IO.Tests { #region Utilities - public override void Replace(string source, string dest, string destBackup) + protected override void Replace(string source, string dest, string destBackup) { File.Replace(source, dest, destBackup, false); } diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/CopyTo.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/CopyTo.cs index 473e5beddb0..c078c8039f5 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/CopyTo.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/CopyTo.cs @@ -8,7 +8,7 @@ namespace System.IO.Tests { public class FileInfo_CopyTo_str : File_Copy_str_str { - public override void Copy(string source, string dest) + protected override void Copy(string source, string dest) { new FileInfo(source).CopyTo(dest); } @@ -16,12 +16,12 @@ namespace System.IO.Tests public class FileInfo_CopyTo_str_b : File_Copy_str_str_b { - public override void Copy(string source, string dest) + protected override void Copy(string source, string dest) { new FileInfo(source).CopyTo(dest, false); } - public override void Copy(string source, string dest, bool overwrite) + protected override void Copy(string source, string dest, bool overwrite) { new FileInfo(source).CopyTo(dest, overwrite); } diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/Delete.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/Delete.cs index 37db224614f..9a76d69e3b0 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/Delete.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/Delete.cs @@ -8,7 +8,7 @@ namespace System.IO.Tests { public class FileInfo_Delete : File_Delete { - public override void Delete(string path) + protected override void Delete(string path) { new FileInfo(path).Delete(); } diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs index 51578ac9c9d..0c85a526867 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/GetSetTimes.cs @@ -11,7 +11,7 @@ namespace System.IO.Tests { public class FileInfo_GetSetTimes : InfoGetSetTimes { - public override FileInfo GetExistingItem() + protected override FileInfo GetExistingItem() { string path = GetTestFilePath(); File.Create(path).Dispose(); @@ -55,11 +55,11 @@ namespace System.IO.Tests return fileinfo; } - public override FileInfo GetMissingItem() => new FileInfo(GetTestFilePath()); + protected override FileInfo GetMissingItem() => new FileInfo(GetTestFilePath()); - public override string GetItemPath(FileInfo item) => item.FullName; + protected override string GetItemPath(FileInfo item) => item.FullName; - public override void InvokeCreate(FileInfo item) => item.Create(); + protected override void InvokeCreate(FileInfo item) => item.Create(); public override IEnumerable TimeFunctions(bool requiresRoundtripping = false) { diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.cs index aae5872fe80..cd60106e3a4 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.cs @@ -8,7 +8,7 @@ namespace System.IO.Tests { public partial class FileInfo_MoveTo : File_Move { - public override void Move(string sourceFile, string destFile) + protected override void Move(string sourceFile, string destFile) { new FileInfo(sourceFile).MoveTo(destFile); } diff --git a/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.netcoreapp.cs b/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.netcoreapp.cs index c102132b4cb..341db19edfc 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.netcoreapp.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileInfo/MoveTo.netcoreapp.cs @@ -8,7 +8,7 @@ namespace System.IO.Tests { public partial class FileInfo_MoveTo { - public override void Move(string sourceFile, string destFile, bool overwrite) + protected override void Move(string sourceFile, string destFile, bool overwrite) { new FileInfo(sourceFile).MoveTo(destFile, overwrite); } diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/CopyToAsync.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/CopyToAsync.cs index 9bccf98cb76..7d7eb48cf2f 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/CopyToAsync.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/CopyToAsync.cs @@ -253,7 +253,8 @@ namespace System.IO.Tests } [PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes to create async pipe handle - [Theory] + [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Out of current directory operation.")] + [Fact] public async Task NamedPipeViaFileStream_CancellationRequested_OperationCanceled() { string name = Guid.NewGuid().ToString("N"); diff --git a/src/libraries/System.IO.FileSystem/tests/FileStream/Pipes.cs b/src/libraries/System.IO.FileSystem/tests/FileStream/Pipes.cs index 005b46f4c80..773e8b18a7f 100644 --- a/src/libraries/System.IO.FileSystem/tests/FileStream/Pipes.cs +++ b/src/libraries/System.IO.FileSystem/tests/FileStream/Pipes.cs @@ -41,6 +41,8 @@ namespace System.IO.Tests } } + [Fact] + [ActiveIssue(39230)] [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes public async Task FifoReadWriteViaFileStream() { diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateFromFile.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateFromFile.Tests.cs index 7c699d33146..49b0a08df19 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateFromFile.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateFromFile.Tests.cs @@ -666,7 +666,7 @@ namespace System.IO.MemoryMappedFiles.Tests /// If the test is being run under the superuser, however, modification of a ReadOnly /// file is allowed. /// - public void WriteToReadOnlyFile(MemoryMappedFileAccess access, bool succeeds) + private void WriteToReadOnlyFile(MemoryMappedFileAccess access, bool succeeds) { const int Capacity = 4096; using (TempFile file = new TempFile(GetTestFilePath(), Capacity)) diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/ReadTimeout.cs b/src/libraries/System.IO.Ports/tests/SerialPort/ReadTimeout.cs index 4d52576c32c..91f8d9006c3 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/ReadTimeout.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/ReadTimeout.cs @@ -213,7 +213,7 @@ namespace System.IO.Ports.Tests #endregion #region Verification for Test Cases - public void VerifyInfiniteTimeout(Action readMethod, bool setInfiniteTimeout) + private static void VerifyInfiniteTimeout(Action readMethod, bool setInfiniteTimeout) { using (SerialPort com1 = TCSupport.InitFirstSerialPort()) using (SerialPort com2 = TCSupport.InitSecondSerialPort(com1)) diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs b/src/libraries/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs index 1e8a12325fa..92fead289a0 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/Write_byte_int_int.cs @@ -301,7 +301,7 @@ namespace System.IO.Ports.Tests } } - public void VerifyWriteByteArray(byte[] buffer, int offset, int count, SerialPort com1, SerialPort com2) + private void VerifyWriteByteArray(byte[] buffer, int offset, int count, SerialPort com1, SerialPort com2) { VerifyWriteByteArray(buffer, offset, count, com1, com2, DEFAULT_NUM_WRITES); } diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs b/src/libraries/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs index b3ef1b197eb..7a82837cb74 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/Write_char_int_int_Generic.cs @@ -340,7 +340,7 @@ namespace System.IO.Ports.Tests #endregion #region Verification for Test Cases - public static void VerifyWriteException(SerialPort com, Type expectedException) + private static void VerifyWriteException(SerialPort com, Type expectedException) { Assert.Throws(expectedException, () => com.Write(new char[CHAR_SIZE_EXCEPTION], 0, CHAR_SIZE_EXCEPTION)); } diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/Write_str.cs b/src/libraries/System.IO.Ports/tests/SerialPort/Write_str.cs index 52903c996ba..ddddb0b0604 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/Write_str.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/Write_str.cs @@ -117,12 +117,12 @@ namespace System.IO.Ports.Tests #region Verification for Test Cases - public void VerifyWrite(Encoding encoding, int strSize) + private void VerifyWrite(Encoding encoding, int strSize) { VerifyWrite(encoding, strSize, DEFAULT_NUM_WRITES); } - public void VerifyWrite(Encoding encoding, int strSize, int numWrites) + private void VerifyWrite(Encoding encoding, int strSize, int numWrites) { using (SerialPort com1 = TCSupport.InitFirstSerialPort()) using (SerialPort com2 = TCSupport.InitSecondSerialPort(com1)) @@ -139,12 +139,12 @@ namespace System.IO.Ports.Tests } } - public void VerifyWriteStr(SerialPort com1, SerialPort com2, string stringToWrite) + private void VerifyWriteStr(SerialPort com1, SerialPort com2, string stringToWrite) { VerifyWriteStr(com1, com2, stringToWrite, DEFAULT_NUM_WRITES); } - public void VerifyWriteStr(SerialPort com1, SerialPort com2, string stringToWrite, int numWrites) + private void VerifyWriteStr(SerialPort com1, SerialPort com2, string stringToWrite, int numWrites) { char[] actualChars; byte[] expectedBytes, actualBytes; diff --git a/src/libraries/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs b/src/libraries/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs index baac3e97c06..d5a453b5944 100644 --- a/src/libraries/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs +++ b/src/libraries/System.IO.Ports/tests/SerialPort/Write_str_Generic.cs @@ -336,7 +336,7 @@ namespace System.IO.Ports.Tests #endregion #region Verification for Test Cases - public static void VerifyWriteException(SerialPort com, Type expectedException) + private static void VerifyWriteException(SerialPort com, Type expectedException) { Assert.Throws(expectedException, () => com.Write(DEFAULT_STRING)); } diff --git a/src/libraries/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs b/src/libraries/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs index d18612c4af6..f8dd3f16946 100644 --- a/src/libraries/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs +++ b/src/libraries/System.IO.Ports/tests/SerialStream/BeginRead_Generic.cs @@ -315,13 +315,13 @@ namespace System.IO.Ports.Tests } } - public void VerifyBytesToRead(int numBytesRead) + private void VerifyBytesToRead(int numBytesRead) { VerifyBytesToRead(numBytesRead, new ASCIIEncoding()); } - public void VerifyBytesToRead(int numBytesRead, Encoding encoding) + private void VerifyBytesToRead(int numBytesRead, Encoding encoding) { using (var com1 = new SerialPort(TCSupport.LocalMachineSerialInfo.FirstAvailablePortName)) using (var com2 = new SerialPort(TCSupport.LocalMachineSerialInfo.SecondAvailablePortName)) diff --git a/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs b/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs index cdba1e03a13..d29d673f804 100644 --- a/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs +++ b/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.cs @@ -10,9 +10,9 @@ namespace System.IO.Tests { public sealed class ArrayUmsReadWriteTests : UmsReadWriteTests { - public override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + protected override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => stream.Read(array, offset, count); - public override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + protected override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => stream.Write(array, offset, count); [Fact] @@ -56,8 +56,8 @@ namespace System.IO.Tests public abstract class UmsReadWriteTests { - public abstract int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count); - public abstract void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count); + protected abstract int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count); + protected abstract void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count); [Fact] public void EmptyStreamRead() diff --git a/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.netcoreapp.cs b/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.netcoreapp.cs index a438d9cf425..407b07f9462 100644 --- a/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.netcoreapp.cs +++ b/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsReadWrite.netcoreapp.cs @@ -6,17 +6,17 @@ namespace System.IO.Tests { public sealed class SpanUmsReadWriteTests : UmsReadWriteTests { - public override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + protected override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => stream.Read(new Span(array, offset, count)); - public override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + protected override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => stream.Write(new Span(array, offset, count)); } public sealed class MemoryUmsReadWriteTests : UmsReadWriteTests { - public override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + protected override int Read(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => stream.ReadAsync(new Memory(array, offset, count)).GetAwaiter().GetResult(); - public override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => + protected override void Write(UnmanagedMemoryStream stream, byte[] array, int offset, int count) => stream.WriteAsync(new Memory(array, offset, count)).GetAwaiter().GetResult(); } } diff --git a/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsSecurityTest.cs b/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsSecurityTest.cs index 1368fc3ffd3..eba25f8536d 100644 --- a/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsSecurityTest.cs +++ b/src/libraries/System.IO.UnmanagedMemoryStream/tests/UmsSecurityTest.cs @@ -73,7 +73,7 @@ public class UmsSecurityTests Assert.Throws(() => stream.WriteByte(byte.MaxValue)); // Stream does not support writing. } - public static void CheckStreamIntegrity(UnmanagedMemoryStream stream, byte[] originalData) + private static void CheckStreamIntegrity(UnmanagedMemoryStream stream, byte[] originalData) { stream.Position = 0; byte[] streamData = new byte[originalData.Length]; diff --git a/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs b/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs index 17d4f2d5025..60da7f3f74e 100644 --- a/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs +++ b/src/libraries/System.IO/tests/BufferedStream/BufferedStreamTests.cs @@ -334,8 +334,9 @@ namespace System.IO.Tests return new BufferedStream(new MemoryStream()); } - public void EndCallback(IAsyncResult ar) - { } + private void EndCallback(IAsyncResult ar) + { + } [Fact] public void BeginEndReadTest() diff --git a/src/libraries/System.IO/tests/Stream/Stream.APMMethodsTests.cs b/src/libraries/System.IO/tests/Stream/Stream.APMMethodsTests.cs index d762f84d8a6..ec1be37d70c 100644 --- a/src/libraries/System.IO/tests/Stream/Stream.APMMethodsTests.cs +++ b/src/libraries/System.IO/tests/Stream/Stream.APMMethodsTests.cs @@ -16,8 +16,9 @@ namespace System.IO.Tests return new MemoryStream(); } - public void EndCallback(IAsyncResult ar) - { } + private void EndCallback(IAsyncResult ar) + { + } [Fact] public void BeginEndReadTest() diff --git a/src/libraries/System.IO/tests/Stream/Stream.Methods.cs b/src/libraries/System.IO/tests/Stream/Stream.Methods.cs index e0199d308c9..c34c5b72d80 100644 --- a/src/libraries/System.IO/tests/Stream/Stream.Methods.cs +++ b/src/libraries/System.IO/tests/Stream/Stream.Methods.cs @@ -42,7 +42,7 @@ namespace System.IO.Tests await StreamTest(ms1, false); } - public static void SeekTest(Stream stream, bool fSuppres) + private static void SeekTest(Stream stream, bool fSuppres) { long lngPos; byte btValue; @@ -108,9 +108,8 @@ namespace System.IO.Tests Assert.Throws(() => stream.Seek(-1, SeekOrigin.Current)); } - public static async Task StreamTest(Stream stream, bool fSuppress) + private static async Task StreamTest(Stream stream, bool fSuppress) { - string strValue; int iValue; @@ -164,7 +163,6 @@ namespace System.IO.Tests Assert.Equal(i % 256, stream.ReadByte()); } - btArr = new byte[iLength]; stream.Read(btArr, 0, iLength); for (int i = 0; i < iLength; i++) diff --git a/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj b/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj index 5f6264fab59..1166a2d9cdb 100644 --- a/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj +++ b/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj @@ -2,13 +2,13 @@ true - netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release - - {4B4AA59B-89F9-4A34-B3C3-C97EF531EE00} false $(DefineConstants);FEATURE_COMPILE $(DefineConstants);FEATURE_INTERPRET + + true + netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release diff --git a/src/libraries/System.Linq.Parallel/tests/QueryOperators/SequenceEqualTests.cs b/src/libraries/System.Linq.Parallel/tests/QueryOperators/SequenceEqualTests.cs index c9e2b29ac0d..0bc1b9131c6 100644 --- a/src/libraries/System.Linq.Parallel/tests/QueryOperators/SequenceEqualTests.cs +++ b/src/libraries/System.Linq.Parallel/tests/QueryOperators/SequenceEqualTests.cs @@ -134,6 +134,7 @@ namespace System.Linq.Parallel.Tests SequenceEqual_Unequal(left, right, count, item); } + [Fact] public static void SequenceEqual_NotSupportedException() { #pragma warning disable 618 diff --git a/src/libraries/System.Linq.Parallel/tests/QueryOperators/ToLookupTests.cs b/src/libraries/System.Linq.Parallel/tests/QueryOperators/ToLookupTests.cs index 7aab25e10f1..fbe787a142e 100644 --- a/src/libraries/System.Linq.Parallel/tests/QueryOperators/ToLookupTests.cs +++ b/src/libraries/System.Linq.Parallel/tests/QueryOperators/ToLookupTests.cs @@ -123,7 +123,7 @@ namespace System.Linq.Parallel.Tests } } - [Theory] + [Fact] [OuterLoop] public static void ToLookup_ElementSelector_CustomComparator_Longrunning() { diff --git a/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs b/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs index bae9d1e51fc..e73f95f5839 100644 --- a/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs @@ -10,11 +10,12 @@ namespace System.Linq.Tests { public class GroupByTests : EnumerableBasedTests { - public static void AssertGroupingCorrect(IQueryable keys, IQueryable elements, IQueryable> grouping) + private static void AssertGroupingCorrect(IQueryable keys, IQueryable elements, IQueryable> grouping) { AssertGroupingCorrect(keys, elements, grouping, EqualityComparer.Default); } - public static void AssertGroupingCorrect(IQueryable keys, IQueryable elements, IQueryable> grouping, IEqualityComparer keyComparer) + + private static void AssertGroupingCorrect(IQueryable keys, IQueryable elements, IQueryable> grouping, IEqualityComparer keyComparer) { if (grouping == null) { diff --git a/src/libraries/System.Linq.Queryable/tests/MaxTests.cs b/src/libraries/System.Linq.Queryable/tests/MaxTests.cs index 48c27f050be..2b1b8db8963 100644 --- a/src/libraries/System.Linq.Queryable/tests/MaxTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/MaxTests.cs @@ -541,6 +541,7 @@ namespace System.Linq.Tests AssertExtensions.Throws("selector", () => Enumerable.Empty().AsQueryable().Max(selector)); } + [Fact] public void EmptyStringSourceWithSelector() { Assert.Null(Enumerable.Empty().AsQueryable().Max(x => x)); diff --git a/src/libraries/System.Linq/tests/FirstTests.cs b/src/libraries/System.Linq/tests/FirstTests.cs index cd8152de79d..16c58416b01 100644 --- a/src/libraries/System.Linq/tests/FirstTests.cs +++ b/src/libraries/System.Linq/tests/FirstTests.cs @@ -30,7 +30,7 @@ namespace System.Linq.Tests Assert.Equal(q.First(), q.First()); } - public void TestEmptyIList() + private static void TestEmptyIList() { T[] source = { }; diff --git a/src/libraries/System.Linq/tests/GroupByTests.cs b/src/libraries/System.Linq/tests/GroupByTests.cs index c8ffe4e87c7..4628f6a84fe 100644 --- a/src/libraries/System.Linq/tests/GroupByTests.cs +++ b/src/libraries/System.Linq/tests/GroupByTests.cs @@ -11,11 +11,12 @@ namespace System.Linq.Tests { public partial class GroupByTests : EnumerableTests { - public static void AssertGroupingCorrect(IEnumerable keys, IEnumerable elements, IEnumerable> grouping) + private static void AssertGroupingCorrect(IEnumerable keys, IEnumerable elements, IEnumerable> grouping) { AssertGroupingCorrect(keys, elements, grouping, EqualityComparer.Default); } - public static void AssertGroupingCorrect(IEnumerable keys, IEnumerable elements, IEnumerable> grouping, IEqualityComparer keyComparer) + + private static void AssertGroupingCorrect(IEnumerable keys, IEnumerable elements, IEnumerable> grouping, IEqualityComparer keyComparer) { if (grouping == null) { diff --git a/src/libraries/System.Linq/tests/LastTests.cs b/src/libraries/System.Linq/tests/LastTests.cs index 8fe36ac6c05..a6c6dd290b6 100644 --- a/src/libraries/System.Linq/tests/LastTests.cs +++ b/src/libraries/System.Linq/tests/LastTests.cs @@ -30,7 +30,7 @@ namespace System.Linq.Tests Assert.Equal(q.Last(), q.Last()); } - public void TestEmptyIList() + private static void TestEmptyIList() { T[] source = { }; diff --git a/src/libraries/System.Linq/tests/SelectTests.cs b/src/libraries/System.Linq/tests/SelectTests.cs index b74c842beb6..6897c6f14da 100644 --- a/src/libraries/System.Linq/tests/SelectTests.cs +++ b/src/libraries/System.Linq/tests/SelectTests.cs @@ -1182,24 +1182,6 @@ namespace System.Linq.Tests Assert.Equal(source.Count(), timesRun); } - // [Theory] - [MemberData(nameof(RunSelectorDuringCountData))] - public void RunSelectorDuringPartitionCount(IEnumerable source) - { - int timesRun = 0; - - var selected = source.Select(i => timesRun++); - - if (source.Any()) - { - selected.Skip(1).Count(); - Assert.Equal(source.Count() - 1, timesRun); - - selected.Take(source.Count() - 1).Count(); - Assert.Equal(source.Count() * 2 - 2, timesRun); - } - } - public static IEnumerable RunSelectorDuringCountData() { var transforms = new Func, IEnumerable>[] diff --git a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Byte.cs b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Byte.cs index 7f244d437d0..85445bb9b7a 100644 --- a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Byte.cs +++ b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Byte.cs @@ -10,7 +10,7 @@ namespace System.Buffers.Tests { public class ArrayBufferWriterTests_Byte : ArrayBufferWriterTests { - public override void WriteData(IBufferWriter bufferWriter, int numBytes) + protected override void WriteData(IBufferWriter bufferWriter, int numBytes) { Span outputSpan = bufferWriter.GetSpan(numBytes); Assert.True(outputSpan.Length >= numBytes); diff --git a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Char.cs b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Char.cs index 0b97c951152..6584a1e09bd 100644 --- a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Char.cs +++ b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.Char.cs @@ -8,7 +8,7 @@ namespace System.Buffers.Tests { public class ArrayBufferWriterTests_Char : ArrayBufferWriterTests { - public override void WriteData(IBufferWriter bufferWriter, int numChars) + protected override void WriteData(IBufferWriter bufferWriter, int numChars) { Span outputSpan = bufferWriter.GetSpan(numChars); Debug.Assert(outputSpan.Length >= numChars); diff --git a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.String.cs b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.String.cs index 4c4ecf1a6cb..6e5093a1b9e 100644 --- a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.String.cs +++ b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.String.cs @@ -9,7 +9,7 @@ namespace System.Buffers.Tests { public class ArrayBufferWriterTests_String : ArrayBufferWriterTests { - public override void WriteData(IBufferWriter bufferWriter, int numStrings) + protected override void WriteData(IBufferWriter bufferWriter, int numStrings) { Span outputSpan = bufferWriter.GetSpan(numStrings); Debug.Assert(outputSpan.Length >= numStrings); diff --git a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs index 013307af7bf..c4e9d88bcaa 100644 --- a/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs +++ b/src/libraries/System.Memory/tests/ArrayBufferWriter/ArrayBufferWriterTests.T.cs @@ -392,7 +392,7 @@ namespace System.Buffers.Tests } } - public abstract void WriteData(IBufferWriter bufferWriter, int numBytes); + protected abstract void WriteData(IBufferWriter bufferWriter, int numBytes); public static IEnumerable SizeHints { diff --git a/src/libraries/System.Memory/tests/Base64/Base64TestHelper.cs b/src/libraries/System.Memory/tests/Base64/Base64TestHelper.cs index 667a6916144..f653fe3c13c 100644 --- a/src/libraries/System.Memory/tests/Base64/Base64TestHelper.cs +++ b/src/libraries/System.Memory/tests/Base64/Base64TestHelper.cs @@ -65,7 +65,7 @@ namespace System.Buffers.Text.Tests } } - public static void InitalizeBytes(Span bytes, int seed = 100) + internal static void InitalizeBytes(Span bytes, int seed = 100) { var rnd = new Random(seed); for (int i = 0; i < bytes.Length; i++) @@ -74,7 +74,7 @@ namespace System.Buffers.Text.Tests } } - public static void InitalizeDecodableBytes(Span bytes, int seed = 100) + internal static void InitalizeDecodableBytes(Span bytes, int seed = 100) { var rnd = new Random(seed); for (int i = 0; i < bytes.Length; i++) diff --git a/src/libraries/System.Memory/tests/Span/GcReporting.cs b/src/libraries/System.Memory/tests/Span/GcReporting.cs index efbd46bba99..8b8298311ac 100644 --- a/src/libraries/System.Memory/tests/Span/GcReporting.cs +++ b/src/libraries/System.Memory/tests/Span/GcReporting.cs @@ -12,24 +12,10 @@ namespace System.SpanTests /// This is a simple sanity test to check that GC reporting for Span is not completely broken, it is not meant to be /// comprehensive. /// - [Fact] + [InlineData(100_000, 10_000)] + [InlineData(100, 100)] [OuterLoop] - public static void DelegateTest() - { - DelegateTest(100000, 10000); - } - - /// - /// Intended entry point for stress tests, with counts appropriate for GCStress=3. The counts in - /// are too high for running that test in a reasonable amount of time. This one runs in a - /// reasonable amount of time for a long-duration stress run. - /// - public static void DelegateTest_Stress() - { - DelegateTest(100, 100); - } - - private static void DelegateTest(int iterationCount, int objectCount) + public static void DelegateTest(int iterationCount, int objectCount) { object[] objects = new object[objectCount]; Random rng = new Random(); diff --git a/src/libraries/System.Net.HttpListener/tests/HttpListenerContextTests.cs b/src/libraries/System.Net.HttpListener/tests/HttpListenerContextTests.cs index 657ad2e8627..137bc186a2b 100644 --- a/src/libraries/System.Net.HttpListener/tests/HttpListenerContextTests.cs +++ b/src/libraries/System.Net.HttpListener/tests/HttpListenerContextTests.cs @@ -55,7 +55,7 @@ namespace System.Net.Tests Assert.Equal(serverProtocol, socketContext.WebSocket.SubProtocol); } - [ConditionalTheory(nameof(IsNotWindows7))] + [ConditionalFact(nameof(IsNotWindows7))] public async Task AcceptWebSocketAsync_ValidWebSocket_SetsUpHeadersInResponse() { HttpListenerContext context = await GetWebSocketContext(new string[] { "SubProtocol", "SubProtocol2" }); diff --git a/src/libraries/System.Net.HttpListener/tests/SimpleHttpTests.cs b/src/libraries/System.Net.HttpListener/tests/SimpleHttpTests.cs index 309f143e99a..15a0fc1dfd2 100644 --- a/src/libraries/System.Net.HttpListener/tests/SimpleHttpTests.cs +++ b/src/libraries/System.Net.HttpListener/tests/SimpleHttpTests.cs @@ -118,11 +118,9 @@ namespace System.Net.Tests } } - [Theory] - public Task UnknownHeaders_Success_Large() => UnknownHeaders_Success(1000); - [Theory] [InlineData(100)] + [InlineData(1000)] public async Task UnknownHeaders_Success(int numHeaders) { Task server = _listener.GetContextAsync(); diff --git a/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs b/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs index 68929076505..25f7f724b34 100644 --- a/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs +++ b/src/libraries/System.Net.Requests/tests/AuthenticationManagerTest.cs @@ -41,6 +41,7 @@ namespace System.Net.Tests }).Dispose(); } + [Fact] public void Register_UnregisterByScheme_ModuleCountUnchanged() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs index 9411a8c771d..7ecfcc85f59 100644 --- a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs @@ -1531,6 +1531,7 @@ namespace System.Net.Tests Assert.Equal(MediaType, request.MediaType); } + [Fact] public async Task HttpWebRequest_EndGetRequestStreamContext_ExpectedValue() { await LoopbackServer.CreateServerAsync((server, url) => diff --git a/src/libraries/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs b/src/libraries/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs index 5c953782d8f..9f78ced3bc2 100644 --- a/src/libraries/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs +++ b/src/libraries/System.Net.Requests/tests/HttpWebResponseHeaderTest.cs @@ -16,7 +16,7 @@ namespace System.Net.Tests { public class HttpWebResponseHeaderTest { - public void HttpContinueMethod(int StatusCode, WebHeaderCollection httpHeaders) + private static void HttpContinueMethod(int StatusCode, WebHeaderCollection httpHeaders) { } diff --git a/src/libraries/System.Net.Requests/tests/WebRequestTest.cs b/src/libraries/System.Net.Requests/tests/WebRequestTest.cs index 4acc29f35be..14d750e6f85 100644 --- a/src/libraries/System.Net.Requests/tests/WebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/WebRequestTest.cs @@ -159,6 +159,7 @@ namespace System.Net.Tests Assert.Throws(() => request.Proxy = null); } + [Fact] public void GetSystemWebProxy_NoArguments_ExpectNotNull() { IWebProxy webProxy = WebRequest.GetSystemWebProxy(); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/TransportContextTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/TransportContextTest.cs index 5afea7f259f..551bb05301a 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/TransportContextTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/TransportContextTest.cs @@ -44,7 +44,7 @@ namespace System.Net.Security.Tests } } - public void CheckTransportContext(TransportContext context) + private static void CheckTransportContext(TransportContext context) { var cbt1 = context.GetChannelBinding(ChannelBindingKind.Endpoint); var cbt2 = context.GetChannelBinding(ChannelBindingKind.Unique); @@ -68,7 +68,7 @@ namespace System.Net.Security.Tests Assert.True(cbt3 == null, "ChannelBindingKind.Unknown token data should not be returned."); } - public void CheckChannelBinding(ChannelBindingKind kind, ChannelBinding channelBinding) + private static void CheckChannelBinding(ChannelBindingKind kind, ChannelBinding channelBinding) { if (channelBinding != null) { diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs index a22d8b8051b..e61d29be5bb 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs @@ -19,7 +19,8 @@ namespace System.Net.Sockets.Tests _log = TestLogging.GetInstance(); Assert.True(Capability.IPv4Support() || Capability.IPv6Support()); } - public void OnCompleted(object sender, SocketAsyncEventArgs args) + + private static void OnCompleted(object sender, SocketAsyncEventArgs args) { EventWaitHandle handle = (EventWaitHandle)args.UserToken; handle.Set(); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs index b3476fbe6cd..607a7ad1322 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DnsEndPointTest.cs @@ -404,7 +404,7 @@ namespace System.Net.Sockets.Tests complete.Dispose(); } - public void CallbackThatShouldNotBeCalled(object sender, SocketAsyncEventArgs args) + private static void CallbackThatShouldNotBeCalled(object sender, SocketAsyncEventArgs args) { throw new ShouldNotBeInvokedException(); } diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs index 5482abca1d7..13d723ac7ed 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SelectTest.cs @@ -111,8 +111,9 @@ namespace System.Net.Sockets.Tests } } + [Fact] [PlatformSpecific(~TestPlatforms.OSX)] // typical OSX install has very low max open file descriptors value - public void Select_Read_OneReadyAtATime_ManySockets(int reads) + public void Select_Read_OneReadyAtATime_ManySockets() { Select_Read_OneReadyAtATime(90); // value larger than the internal value in SocketPal.Unix that swaps between stack and heap allocation } @@ -268,7 +269,7 @@ namespace System.Net.Sockets.Tests } } - public static void DoAccept(Socket listenSocket, int connectionsToAccept) + private static void DoAccept(Socket listenSocket, int connectionsToAccept) { int connectionCount = 0; while (true) diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs index 7b15dd2c112..ebe84d5baca 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketAsyncEventArgsTest.cs @@ -481,7 +481,7 @@ namespace System.Net.Sockets.Tests } } - public void OnAcceptCompleted(object sender, SocketAsyncEventArgs args) + private static void OnAcceptCompleted(object sender, SocketAsyncEventArgs args) { EventWaitHandle handle = (EventWaitHandle)args.UserToken; handle.Set(); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/UdpClientTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/UdpClientTest.cs index b500ee4364a..c0d53e778c7 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/UdpClientTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/UdpClientTest.cs @@ -382,6 +382,7 @@ namespace System.Net.Sockets.Tests } } + [Fact] [PlatformSpecific(TestPlatforms.Windows)] // localhost on Windows resolves to both IPV4/6, but doesn't on all Unix public void Send_InvalidArguments_StringInt_Throws() { @@ -517,6 +518,7 @@ namespace System.Net.Sockets.Tests } } + [Fact] [PlatformSpecific(TestPlatforms.Windows)] // "localhost" resolves to IPv4 & IPV6 on Windows, but may resolve to only one of those on Unix [OuterLoop] // TODO: Issue #11345 public void Send_Receive_Connected_Success() @@ -579,6 +581,7 @@ namespace System.Net.Sockets.Tests } } + [Fact] [PlatformSpecific(TestPlatforms.Windows)] // "localhost" resolves to IPv4 & IPV6 on Windows, but may resolve to only one of those on Unix [OuterLoop] // TODO: Issue #11345 public void BeginEndSend_BeginEndReceive_Connected_Success() @@ -622,6 +625,7 @@ namespace System.Net.Sockets.Tests } } + [Fact] [PlatformSpecific(TestPlatforms.Windows)] // "localhost" resolves to IPv4 & IPV6 on Windows, but may resolve to only one of those on Unix [OuterLoop] // TODO: Issue #11345 public async Task SendAsync_ReceiveAsync_Connected_Success() diff --git a/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.cs b/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.cs index 1c989831cb1..b7e26349756 100644 --- a/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.cs +++ b/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.cs @@ -92,7 +92,7 @@ namespace System.Net.WebSockets.Client.Tests } [OuterLoop("Uses external servers")] - [ConditionalTheory(nameof(WebSocketsSupported))] + [ConditionalFact(nameof(WebSocketsSupported))] public async Task ConnectAsync_AddHostHeader_Success() { Uri server = System.Net.Test.Common.Configuration.WebSockets.RemoteEchoServer; diff --git a/src/libraries/System.Private.Uri/tests/FunctionalTests/IdnHostNameValidationTest.cs b/src/libraries/System.Private.Uri/tests/FunctionalTests/IdnHostNameValidationTest.cs index b76ada2b603..acd60a75910 100644 --- a/src/libraries/System.Private.Uri/tests/FunctionalTests/IdnHostNameValidationTest.cs +++ b/src/libraries/System.Private.Uri/tests/FunctionalTests/IdnHostNameValidationTest.cs @@ -103,7 +103,7 @@ namespace System.PrivateUri.Tests #region Helpers - public void CommonSchemesTest(string scheme) + private static void CommonSchemesTest(string scheme) { string unicodeHost = "a\u00FChost.dom\u00FCin.n\u00FCet"; string punycodeHost = "xn--ahost-kva.xn--domin-mva.xn--net-hoa"; @@ -115,7 +115,7 @@ namespace System.PrivateUri.Tests ValidateUri(scheme, punycodeHost, UriHostNameType.Dns, punycodeHost, punycodeHost, punycodeHost); } - public void ValidateUri( + private static void ValidateUri( string scheme, string host, UriHostNameType expectedHostType, diff --git a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs index 14e434932a8..b6921be705d 100644 --- a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs +++ b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs @@ -387,7 +387,7 @@ namespace System.PrivateUri.Tests Assert.Throws(() => uriBuilder.ToString()); // Uri has a password but no username } - public static void VerifyUriBuilder(UriBuilder uriBuilder, string scheme, string userName, string password, string host, int port, string path, string query, string fragment) + private static void VerifyUriBuilder(UriBuilder uriBuilder, string scheme, string userName, string password, string host, int port, string path, string query, string fragment) { Assert.Equal(scheme, uriBuilder.Scheme); Assert.Equal(userName, uriBuilder.UserName); diff --git a/src/libraries/System.Private.Xml.Linq/tests/Schema/ExtensionTests.cs b/src/libraries/System.Private.Xml.Linq/tests/Schema/ExtensionTests.cs index d76d5c2c325..df42d634eb6 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/Schema/ExtensionTests.cs +++ b/src/libraries/System.Private.Xml.Linq/tests/Schema/ExtensionTests.cs @@ -85,29 +85,8 @@ namespace CoreXml.Test.XLinq //LoadOutsideDocuments ("c:\\note.xsd", "c:\\note.xml"); } - // Use this method to load data from disk - public static void LoadOutsideDocuments(string xsdDocumentPath, string xmlDocumentPath) - { - // Create a resolver with default credentials. - XmlUrlResolver resolver = new XmlUrlResolver(); - resolver.Credentials = Network.CredentialCache.DefaultCredentials; - // Set the reader settings object to use the resolver. - XmlReaderSettings settings = new XmlReaderSettings(); - settings.XmlResolver = resolver; - - // Create the XmlReader object. - XmlReader reader = XmlReader.Create(xsdDocumentPath, settings); - - schemaSet = new XmlSchemaSet(); - schemaSet.Add("", reader); - - reader = XmlReader.Create(xmlDocumentPath, settings); - xmlDocument = XDocument.Load(reader); - validationSucceded = false; - } - // this gets called when a validation error occurs - public void TestValidationHandler(object sender, ValidationEventArgs e) + private void TestValidationHandler(object sender, ValidationEventArgs e) { validationSucceded = false; } diff --git a/src/libraries/System.Private.Xml.Linq/tests/Streaming/StreamingOutput.cs b/src/libraries/System.Private.Xml.Linq/tests/Streaming/StreamingOutput.cs index 2e2a8a64011..229e66da760 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/Streaming/StreamingOutput.cs +++ b/src/libraries/System.Private.Xml.Linq/tests/Streaming/StreamingOutput.cs @@ -26,13 +26,13 @@ namespace XDocumentTests.Streaming private Stream _sourceStream = null; private Stream _targetStream = null; - public void GetFreshStream() + private void GetFreshStream() { _sourceStream = new MemoryStream(); _targetStream = new MemoryStream(); } - public void ResetStreamPos() + private void ResetStreamPos() { if (_sourceStream.CanSeek) { diff --git a/src/libraries/System.Private.Xml.Linq/tests/events/EventsName.cs b/src/libraries/System.Private.Xml.Linq/tests/events/EventsName.cs index c5f76965aa4..1b4676e44de 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/events/EventsName.cs +++ b/src/libraries/System.Private.Xml.Linq/tests/events/EventsName.cs @@ -69,8 +69,8 @@ namespace CoreXml.Test.XLinq.FunctionalTests.EventsTests public class EventsSpecialCases { - public void ChangingDelegate(object sender, XObjectChangeEventArgs e) { } - public void ChangedDelegate(object sender, XObjectChangeEventArgs e) { } + private static void ChangingDelegate(object sender, XObjectChangeEventArgs e) { } + private static void ChangedDelegate(object sender, XObjectChangeEventArgs e) { } [Fact] public void AddingRemovingNullListenersXElementRemoveNullEventListner() diff --git a/src/libraries/System.Private.Xml.Linq/tests/misc/RegressionTests.cs b/src/libraries/System.Private.Xml.Linq/tests/misc/RegressionTests.cs index adf475fe365..605de7f3cbc 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/misc/RegressionTests.cs +++ b/src/libraries/System.Private.Xml.Linq/tests/misc/RegressionTests.cs @@ -36,7 +36,7 @@ namespace System.Xml.Linq.Tests Assert.Equal("", e.ToString(SaveOptions.DisableFormatting)); } - //[Variation(Desc = "Replace content")] + [Fact] public void ReplaceContent() { XElement a = XElement.Parse(""); @@ -44,7 +44,7 @@ namespace System.Xml.Linq.Tests XElement x = a; foreach (string s in (new string[] { "A", "B", "B" })) { - TestLog.Compare(x.Name.LocalName, s, s); + Assert.Equal(x.Name.LocalName, s); x = x.FirstNode as XElement; } } diff --git a/src/libraries/System.Private.Xml.Linq/tests/misc/XLinqErrata4.cs b/src/libraries/System.Private.Xml.Linq/tests/misc/XLinqErrata4.cs index 2f732f55a29..13cc3097f77 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/misc/XLinqErrata4.cs +++ b/src/libraries/System.Private.Xml.Linq/tests/misc/XLinqErrata4.cs @@ -182,7 +182,7 @@ namespace System.Xml.Linq.Tests /// /// XElement/XAttribute /// name to be tested - public void RunValidTests(string nodeType, string name) + private static void RunValidTests(string nodeType, string name) { XDocument xDocument = new XDocument(); XElement element = null; @@ -220,7 +220,7 @@ namespace System.Xml.Linq.Tests /// /// XElement/XAttribute /// name to be tested - public void RunInValidTests(string nodeType, string name) + private static void RunInValidTests(string nodeType, string name) { XDocument xDocument = new XDocument(); XElement element = null; @@ -265,7 +265,7 @@ namespace System.Xml.Linq.Tests /// type from CharType class /// character to be used in the name /// name with the character - public string GetName(string charType, char c) + private static string GetName(string charType, char c) { string name = string.Empty; switch (charType) diff --git a/src/libraries/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj b/src/libraries/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj index 57061566066..8792f2c7912 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj +++ b/src/libraries/System.Private.Xml.Linq/tests/xNodeBuilder/System.Xml.Linq.xNodeBuilder.Tests.csproj @@ -1,6 +1,8 @@ {5D4FB9ED-C3AC-4EFA-9FEE-619ED4B4B92D} + + true netcoreapp-Debug;netcoreapp-Release;uap-Debug;uap-Release diff --git a/src/libraries/System.Private.Xml.Linq/tests/xNodeReader/System.Xml.Linq.xNodeReader.Tests.csproj b/src/libraries/System.Private.Xml.Linq/tests/xNodeReader/System.Xml.Linq.xNodeReader.Tests.csproj index f4373881aaf..82780fb7cf7 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/xNodeReader/System.Xml.Linq.xNodeReader.Tests.csproj +++ b/src/libraries/System.Private.Xml.Linq/tests/xNodeReader/System.Xml.Linq.xNodeReader.Tests.csproj @@ -1,6 +1,8 @@ {6E1C5358-7F04-4791-8B5F-6A5A4E42ABF1} + + true netcoreapp-Debug;netcoreapp-Release;uap-Debug;uap-Release diff --git a/src/libraries/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs b/src/libraries/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs index d7e5821530b..405a44ec409 100644 --- a/src/libraries/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs +++ b/src/libraries/System.Private.Xml/tests/Writers/XmlWriterApi/TCFullEndElement.cs @@ -3401,7 +3401,7 @@ namespace System.Xml.Tests } } - public void VerifyValue(Type dest, object expVal, int param) + private void VerifyValue(Type dest, object expVal, int param) { object actual; diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Add_URL.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Add_URL.cs index 4b29962478b..62d2347c6dc 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Add_URL.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Add_URL.cs @@ -377,7 +377,7 @@ namespace System.Xml.Tests return path; } - public void verifyXsd(string file) + private static void verifyXsd(string file) { try { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs index 167caa33791..c2e7e674b4e 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs @@ -26,7 +26,7 @@ namespace System.Xml.Tests public int warningCount; public string testData = null; - public void Initialize() + private void Initialize() { this.testData = Path.Combine(TestData._Root, "AllowXmlAttributes"); bWarningCallback = bErrorCallback = false; @@ -34,7 +34,7 @@ namespace System.Xml.Tests } //hook up validaton callback - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AnyAttribute.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AnyAttribute.cs index 5b8be302ff0..544318bbe9b 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AnyAttribute.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AnyAttribute.cs @@ -24,7 +24,7 @@ namespace System.Xml.Tests } //hook up validaton callback - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs index b360f5bd19e..d169d985bdb 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Compile.cs @@ -27,15 +27,8 @@ namespace System.Xml.Tests public bool WarningInnerExceptionSet = false; public bool ErrorInnerExceptionSet = false; - public void Initialize() - { - bWarningCallback = bErrorCallback = false; - errorCount = warningCount = 0; - WarningInnerExceptionSet = ErrorInnerExceptionSet = false; - } - //hook up validaton callback - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_EnableUpaCheck.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_EnableUpaCheck.cs index a1f59793fe5..2ce3059ee2e 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_EnableUpaCheck.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_EnableUpaCheck.cs @@ -27,7 +27,7 @@ namespace System.Xml.Tests public string testData = null; - public void Initialize() + private void Initialize() { this.testData = Path.Combine(TestData._Root, "EnableUpaCheck"); bWarningCallback = bErrorCallback = false; @@ -36,7 +36,7 @@ namespace System.Xml.Tests } //Hook up validaton callback - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Error) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs index dabbe97eade..15f8bf8a220 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Misc.cs @@ -28,7 +28,7 @@ namespace System.Xml.Tests public bool WarningInnerExceptionSet = false; public bool ErrorInnerExceptionSet = false; - public void Initialize() + private void Initialize() { bWarningCallback = bErrorCallback = false; errorCount = warningCount = 0; @@ -36,7 +36,7 @@ namespace System.Xml.Tests } //hook up validaton callback - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { @@ -397,7 +397,7 @@ namespace System.Xml.Tests } //Regressions - Bug Fixes - public void Callback1(object sender, ValidationEventArgs args) + private void Callback1(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ProhibitDTD.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ProhibitDTD.cs index 901b540be33..46e6af9f29d 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ProhibitDTD.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ProhibitDTD.cs @@ -25,14 +25,14 @@ namespace System.Xml.Tests public int errorCount; public int warningCount; - public void Initialize() + private void Initialize() { bWarningCallback = bErrorCallback = false; errorCount = warningCount = 0; } //hook up validaton callback - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { switch (args.Severity) { @@ -208,6 +208,8 @@ namespace System.Xml.Tests return; } + [Theory] + [ActiveIssue(39106)] //[Variation(Desc = "v5.2- Test Default value of ProhibitDTD for Add(TextReader) for schema with DTD", Priority = 1, Params = new object[] { "bug356711_a.xsd", 0 })] [InlineData("bug356711_a.xsd", 0)] //[Variation(Desc = "v5.1- Test Default value of ProhibitDTD for Add(TextReader) with an xs:import for schema with DTD", Priority = 1, Params = new object[] { "bug356711.xsd", 0 })] @@ -232,9 +234,10 @@ namespace System.Xml.Tests } CError.Compare(warningCount, (int)param1, "Warning Count mismatch"); CError.Compare(errorCount, 0, "Error Count mismatch"); - return; } + [Theory] + [ActiveIssue(39106)] //[Variation(Desc = "v6.2- Test Default value of ProhibitDTD for Add(XmlTextReader) for schema with DTD", Priority = 1, Params = new object[] { "bug356711_a.xsd" })] [InlineData("bug356711_a.xsd")] //[Variation(Desc = "v6.1- Test Default value of ProhibitDTD for Add(XmlTextReader) with an xs:import for schema with DTD", Priority = 1, Params = new object[] { "bug356711.xsd" })] @@ -257,7 +260,6 @@ namespace System.Xml.Tests // expect a validation warning for unresolvable schema location CError.Compare(warningCount, 0, "Warning Count mismatch"); CError.Compare(errorCount, 0, "Error Count mismatch"); - return; } //[Variation(Desc = "v7- Test Default value of ProhibitDTD for Add(XmlReader) for schema with DTD", Priority = 1, Params = new object[] { "bug356711_a.xsd" })] diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_RemoveRecursive.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_RemoveRecursive.cs index 41b7f67a0f4..397380b1ffd 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_RemoveRecursive.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_RemoveRecursive.cs @@ -24,7 +24,7 @@ namespace System.Xml.Tests public bool bWarningCallback = false; public bool bErrorCallback = false; - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Reprocess.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Reprocess.cs index 269dffa0703..7d5c67c812b 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Reprocess.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Reprocess.cs @@ -23,7 +23,7 @@ namespace System.Xml.Tests public bool bWarningCallback = false; public bool bErrorCallback = false; - public void ValidateSchemaSet(XmlSchemaSet ss, int schCount, bool isCompiled, int countGT, int countGE, int countGA, string str) + private void ValidateSchemaSet(XmlSchemaSet ss, int schCount, bool isCompiled, int countGT, int countGE, int countGA, string str) { _output.WriteLine(str); Assert.Equal(ss.Count, schCount); @@ -33,7 +33,7 @@ namespace System.Xml.Tests Assert.Equal(ss.GlobalAttributes.Count, countGA); } - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ValidationEventHandler.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ValidationEventHandler.cs index b01f9e350e3..05442a11717 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ValidationEventHandler.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_ValidationEventHandler.cs @@ -22,7 +22,7 @@ namespace System.Xml.Tests private ArrayList _ValidationErrors = new ArrayList(); - public void ValidationCallBack(object sender, ValidationEventArgs args) + private void ValidationCallBack(object sender, ValidationEventArgs args) { _output.WriteLine("***{0}", args.Message); _ValidationErrors.Add(args); diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_XmlResolver.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_XmlResolver.cs index b49f5e8c952..bfb51cf21bc 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_XmlResolver.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_XmlResolver.cs @@ -23,13 +23,13 @@ namespace System.Xml.Tests public bool bErrorCallback; - public void Initialize() + private void Initialize() { bWarningCallback = bErrorCallback = false; } //hook up validaton callback - public void ValidationCallback(object sender, ValidationEventArgs args) + private void ValidationCallback(object sender, ValidationEventArgs args) { if (args.Severity == XmlSeverityType.Warning) { diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs index 35b70914ef6..981079f3245 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs @@ -613,22 +613,5 @@ namespace System.Xml.Tests } Assert.True(false); } - - public void RunTest(ArrayList schemaList, string xml) - { - XmlReaderSettings settings = new XmlReaderSettings(); - settings.ValidationType = ValidationType.Schema; - settings.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings; - settings.Schemas.XmlResolver = new XmlUrlResolver(); - - for (int i = 0; i < schemaList.Count; ++i) - { - XmlSchema schema = XmlSchema.Read(new StringReader((string)schemaList[i]), new ValidationEventHandler(ValidationCallback)); - settings.Schemas.Add(schema); - } - settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallback); - using (XmlReader reader = XmlReader.Create(new StringReader(xml), settings)) - while (reader.Read()) ; - } } } diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs index 64689540061..434edf6f39e 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateMisc.cs @@ -769,7 +769,7 @@ namespace System.Xml.Tests "; - public void CreateSchema1(string testDirectory) + private static void CreateSchema1(string testDirectory) { string commonxsd = @" return simpleType2D; } + [Fact] public static void Xml_TypeWithByteArrayAsXmlText() { var value = new TypeWithByteArrayAsXmlText() { Value = new byte[] { 1, 2, 3 } }; diff --git a/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslTransformMultith.cs b/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslTransformMultith.cs index 719c96e0d47..3ff45bfdf70 100644 --- a/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslTransformMultith.cs +++ b/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XslTransformMultith.cs @@ -46,7 +46,7 @@ namespace System.Xml.Tests _output = output; } - public void Load(string _strXslFile, string _strXmlFile) + private void Load(string _strXslFile, string _strXmlFile) { _xrData = XmlReader.Create(Path.Combine(_strPath, _strXmlFile)); _xd = new XPathDocument(_xrData, XmlSpace.Preserve); @@ -360,7 +360,7 @@ namespace System.Xml.Tests return 1; } - public void Load(string _strXslFile, string _strXmlFile) + private void Load(string _strXslFile, string _strXmlFile) { _xrData = XmlReader.Create(Path.Combine(_strPath, _strXmlFile)); _xd = new XPathDocument(_xrData, XmlSpace.Preserve); diff --git a/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XsltArgumentList.cs b/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XsltArgumentList.cs index 4adcfc5efe1..3308efe1e85 100644 --- a/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XsltArgumentList.cs +++ b/src/libraries/System.Private.Xml/tests/Xslt/XslCompiledTransformApi/XsltArgumentList.cs @@ -4524,7 +4524,7 @@ namespace System.Xml.Tests _output = output; } - public void SerializeMessage(string outFile, string message) + private static void SerializeMessage(string outFile, string message) { StreamWriter sw = new StreamWriter(new FileStream(outFile, FileMode.Create, FileAccess.Write)); sw.Write(message); diff --git a/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransformMultith.cs b/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransformMultith.cs index 64f05aaaec0..a7c9b25c984 100644 --- a/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransformMultith.cs +++ b/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransformMultith.cs @@ -30,7 +30,7 @@ namespace System.Xml.Tests Init(null); } - public new void Init(object objParam) + private new void Init(object objParam) { #pragma warning disable 0618 xsltSameInstance = new XslTransform(); @@ -39,7 +39,7 @@ namespace System.Xml.Tests return; } - public virtual void Load(string _strXslFile, string _strXmlFile) + protected virtual void Load(string _strXslFile, string _strXmlFile) { } @@ -108,7 +108,7 @@ namespace System.Xml.Tests _output = output; } - public override void Load(string _strXslFile, string _strXmlFile) + protected override void Load(string _strXslFile, string _strXmlFile) { #pragma warning disable 0618 XmlValidatingReader xrData = new XmlValidatingReader(new XmlTextReader(Path.Combine(_strPath, _strXmlFile))); @@ -148,7 +148,7 @@ namespace System.Xml.Tests _output = output; } - public override void Load(string _strXslFile, string _strXmlFile) + protected override void Load(string _strXslFile, string _strXmlFile) { #pragma warning disable 0618 XmlValidatingReader xrData = new XmlValidatingReader(new XmlTextReader(Path.Combine(_strPath, _strXmlFile))); diff --git a/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs b/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs index 579fe1853ff..4a2ef63508a 100644 --- a/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs +++ b/src/libraries/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs @@ -201,7 +201,7 @@ namespace System.Xml.Tests } } - public void Init(object objParam) + protected void Init(object objParam) { // FullFilePath and FullHttpPath attempt to normalize file paths, however // as an extra step we can normalize them here, when they are first read diff --git a/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs index 62a49b4ea70..12abf7d22d6 100644 --- a/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/AssemblyBuilderTests.cs @@ -293,7 +293,7 @@ namespace System.Reflection.Emit.Tests } } - public static void VerifyAssemblyBuilder(AssemblyBuilder assembly, AssemblyName name, IEnumerable attributes) + private static void VerifyAssemblyBuilder(AssemblyBuilder assembly, AssemblyName name, IEnumerable attributes) { Assert.StartsWith(name.ToString(), assembly.FullName); Assert.StartsWith(name.ToString(), assembly.GetName().ToString()); diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefinePInvokeMethod.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefinePInvokeMethod.cs index 17a688ff3c1..71873cf643c 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefinePInvokeMethod.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefinePInvokeMethod.cs @@ -177,7 +177,7 @@ namespace System.Reflection.Emit.Tests } } - public static void VerifyPInvokeMethod(Type type, MethodInfo method, DpmParams p) + internal static void VerifyPInvokeMethod(Type type, MethodInfo method, DpmParams p) { Assert.Equal(type.AsType(), method.DeclaringType); Assert.Equal(p.MethodName, method.Name); diff --git a/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Compat.cs b/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Compat.cs index ec0b99f9f26..8eda0be040c 100644 --- a/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Compat.cs +++ b/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Compat.cs @@ -38,7 +38,7 @@ namespace System.Reflection.Tests CheckReturnType(attributes); } - public void CheckReturnType(IEnumerable attributes) + private static void CheckReturnType(IEnumerable attributes) { Type expectedType = typeof(MyAttribute[]); Type actualType = attributes.GetType(); diff --git a/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/CustomAttributeTests.cs b/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/CustomAttributeTests.cs index afda2211939..c6b06dfc261 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/CustomAttributeTests.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/CustomAttributeTests.cs @@ -117,14 +117,14 @@ namespace System.Reflection.Tests } } - public static void ValidateCustomAttributesAllocatesFreshObjectsEachTime(Func> action) + internal static void ValidateCustomAttributesAllocatesFreshObjectsEachTime(Func> action) { IEnumerable cads1 = action(); IEnumerable cads2 = action(); cads1.ValidateEqualButFreshlyAllocated(cads2); } - public static void ValidateEqualButFreshlyAllocated(this IEnumerable cads1, IEnumerable cads2) + internal static void ValidateEqualButFreshlyAllocated(this IEnumerable cads1, IEnumerable cads2) { CustomAttributeData[] acads1 = cads1.ToArray(); CustomAttributeData[] acads2 = cads2.ToArray(); diff --git a/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeInvariants.cs b/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeInvariants.cs index 8df08543472..0a363742c31 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeInvariants.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeInvariants.cs @@ -64,7 +64,7 @@ namespace System.Reflection.Tests openDictionary.TestConstructedGenericTypeInvariants(); } - public static void TestTypeInvariants(this Type type) + internal static void TestTypeInvariants(this Type type) { if (type.IsTypeDefinition()) type.TestTypeDefinitionInvariants(); @@ -78,7 +78,7 @@ namespace System.Reflection.Tests Assert.True(false, "Type does not identify as any of the known flavors: " + type); } - public static void TestTypeDefinitionInvariants(this Type type) + internal static void TestTypeDefinitionInvariants(this Type type) { Assert.True(type.IsTypeDefinition()); if (type.IsGenericTypeDefinition) @@ -91,7 +91,7 @@ namespace System.Reflection.Tests } } - public static void TestGenericTypeDefinitionInvariants(this Type type) + internal static void TestGenericTypeDefinitionInvariants(this Type type) { Assert.True(type.IsGenericTypeDefinition); @@ -112,7 +112,7 @@ namespace System.Reflection.Tests } } - public static void TestHasElementTypeInvariants(this Type type) + internal static void TestHasElementTypeInvariants(this Type type) { Assert.True(type.HasElementType); @@ -126,7 +126,7 @@ namespace System.Reflection.Tests type.TestPointerInvariants(); } - public static void TestArrayInvariants(this Type type) + internal static void TestArrayInvariants(this Type type) { Assert.True(type.IsArray); @@ -149,7 +149,7 @@ namespace System.Reflection.Tests Assert.Equal(0, mems.Length); } - public static void TestSzArrayInvariants(this Type type) + internal static void TestSzArrayInvariants(this Type type) { Assert.True(type.IsSZArray()); @@ -168,7 +168,7 @@ namespace System.Reflection.Tests } } - public static void TestMdArrayInvariants(this Type type) + internal static void TestMdArrayInvariants(this Type type) { Assert.True(type.IsVariableBoundArray()); @@ -198,7 +198,7 @@ namespace System.Reflection.Tests } - public static void TestByRefInvariants(this Type type) + internal static void TestByRefInvariants(this Type type) { Assert.True(type.IsByRef); @@ -225,7 +225,7 @@ namespace System.Reflection.Tests Assert.Equal(0, members.Length); } - public static void TestPointerInvariants(this Type type) + internal static void TestPointerInvariants(this Type type) { Assert.True(type.IsPointer); @@ -252,12 +252,12 @@ namespace System.Reflection.Tests Assert.Equal(0, members.Length); } - public static void TestConstructedGenericTypeInvariants(this Type type) + internal static void TestConstructedGenericTypeInvariants(this Type type) { type.TestConstructedGenericTypeCommonInvariants(); } - public static void TestGenericParameterInvariants(this Type type) + internal static void TestGenericParameterInvariants(this Type type) { Assert.True(type.IsGenericParameter); @@ -269,7 +269,7 @@ namespace System.Reflection.Tests Assert.Equal(0, members.Length); } - public static void TestGenericTypeParameterInvariants(this Type type) + internal static void TestGenericTypeParameterInvariants(this Type type) { Assert.True(type.IsGenericTypeParameter()); @@ -285,7 +285,7 @@ namespace System.Reflection.Tests Assert.Equal(gps[position], type); } - public static void TestGenericMethodParameterInvariants(this Type type) + internal static void TestGenericMethodParameterInvariants(this Type type) { Assert.True(type.IsGenericMethodParameter()); diff --git a/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeTests.Get.CornerCases.cs b/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeTests.Get.CornerCases.cs index f17304d3264..56e87517b4c 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeTests.Get.CornerCases.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Type/TypeTests.Get.CornerCases.cs @@ -66,7 +66,7 @@ namespace System.Reflection.Tests Assert.Equal(5, members.Length); } - //[Fact] + [Fact] public static void TestGetMemberEvent() { Type t = typeof(TestClass).Project(); @@ -76,7 +76,7 @@ namespace System.Reflection.Tests Assert.Equal("MyEvent", members[0].Name); } - //[Fact] + [Fact] public static void TestGetMemberField() { Type t = typeof(TestClass).Project(); @@ -86,7 +86,7 @@ namespace System.Reflection.Tests Assert.Equal("MyField", members[0].Name); } - //[Fact] + [Fact] public static void TestGetMemberMethod() { Type t = typeof(TestClass).Project(); @@ -96,7 +96,7 @@ namespace System.Reflection.Tests Assert.Equal("MyMethod", members[0].Name); } - //[Fact] + [Fact] public static void TestGetMemberNestedType() { Type t = typeof(TestClass).Project(); @@ -106,7 +106,7 @@ namespace System.Reflection.Tests Assert.Equal("MyNestedType", members[0].Name); } - //[Fact] + [Fact] public static void TestGetMemberProperty() { Type t = typeof(TestClass).Project(); diff --git a/src/libraries/System.Reflection.TypeExtensions/tests/PropertyInfoTests.cs b/src/libraries/System.Reflection.TypeExtensions/tests/PropertyInfoTests.cs index 9c1053ef113..6dd910d50a6 100644 --- a/src/libraries/System.Reflection.TypeExtensions/tests/PropertyInfoTests.cs +++ b/src/libraries/System.Reflection.TypeExtensions/tests/PropertyInfoTests.cs @@ -62,7 +62,7 @@ namespace System.Reflection.Tests Assert.Equal(ExcludeNulls(property.GetGetMethod(true), property.GetSetMethod(true)), property.GetAccessors(true)); } - public static void VerifyGetMethod(PropertyInfo property, MethodInfo method, bool exists, bool nonPublic) + private static void VerifyGetMethod(PropertyInfo property, MethodInfo method, bool exists, bool nonPublic) { Assert.Equal(exists, method != null); if (exists) @@ -76,7 +76,7 @@ namespace System.Reflection.Tests } } - public static void VerifySetMethod(PropertyInfo property, MethodInfo method, bool exists, bool nonPublic) + private static void VerifySetMethod(PropertyInfo property, MethodInfo method, bool exists, bool nonPublic) { Assert.Equal(exists, method != null); if (exists) diff --git a/src/libraries/System.Reflection/tests/AssemblyTests.cs b/src/libraries/System.Reflection/tests/AssemblyTests.cs index d34b9f96be3..b0c3b2d6f03 100644 --- a/src/libraries/System.Reflection/tests/AssemblyTests.cs +++ b/src/libraries/System.Reflection/tests/AssemblyTests.cs @@ -521,19 +521,6 @@ namespace System.Reflection.Tests } } - public IEnumerable ToString_TestData() - { - yield return new object[] { Helpers.ExecutingAssembly, "System.Reflection.Tests" }; - yield return new object[] { Assembly.Load(new AssemblyName(typeof(List).GetTypeInfo().Assembly.FullName)), "PublicKeyToken=" }; - } - - [Theory] - public void ToString(Assembly assembly, string expected) - { - Assert.Contains(expected, assembly.ToString()); - Assert.Equal(assembly.ToString(), assembly.FullName); - } - public static IEnumerable Equality_TestData() { yield return new object[] { Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName)), Assembly.Load(new AssemblyName(typeof(int).GetTypeInfo().Assembly.FullName)), true }; @@ -656,28 +643,27 @@ namespace System.Reflection.Tests Assert.Equal(assembly.FullName, loadedAssembly.FullName); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Assembly.ReflectionOnlyLoad() not supported on UWP")] + [Fact] public void AssemblyReflectionOnlyLoadFromString() { AssemblyName an = typeof(AssemblyTests).Assembly.GetName(); - Assert.Throws(() => Assembly.ReflectionOnlyLoad(an.FullName)); + Assert.Throws(() => Assembly.ReflectionOnlyLoad(an.FullName)); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Assembly.ReflectionOnlyLoad() not supported on UWP")] + [Fact] public void AssemblyReflectionOnlyLoadFromBytes() { Assembly assembly = typeof(AssemblyTests).Assembly; byte[] aBytes = System.IO.File.ReadAllBytes(assembly.Location); - Assert.Throws(() => Assembly.ReflectionOnlyLoad(aBytes)); + Assert.Throws(() => Assembly.ReflectionOnlyLoad(aBytes)); } - [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Assembly.ReflectionOnlyLoad() not supported on UWP")] + [Fact] public void AssemblyReflectionOnlyLoadFromNeg() { - Assert.Throws(() => Assembly.ReflectionOnlyLoad((string)null)); - AssertExtensions.Throws(null, () => Assembly.ReflectionOnlyLoad(string.Empty)); - - Assert.Throws(() => Assembly.ReflectionOnlyLoad((byte[])null)); + Assert.Throws(() => Assembly.ReflectionOnlyLoad((string)null)); + Assert.Throws(() => Assembly.ReflectionOnlyLoad(string.Empty)); + Assert.Throws(() => Assembly.ReflectionOnlyLoad((byte[])null)); } public static IEnumerable GetModules_TestData() diff --git a/src/libraries/System.Reflection/tests/MethodInfoTests.cs b/src/libraries/System.Reflection/tests/MethodInfoTests.cs index 77baebfa92a..ec8c728f0ca 100644 --- a/src/libraries/System.Reflection/tests/MethodInfoTests.cs +++ b/src/libraries/System.Reflection/tests/MethodInfoTests.cs @@ -561,12 +561,13 @@ namespace System.Reflection.Tests Assert.Equal(expected, methodInfo.ToString()); } + //Methods for Reflection Metadata - public void DummyMethod1(string str, int iValue, long lValue) + private void DummyMethod1(string str, int iValue, long lValue) { } - public void DummyMethod2() + private void DummyMethod2() { } diff --git a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs index 8cf246ddf69..79b739a4281 100644 --- a/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs +++ b/src/libraries/System.Resources.ResourceManager/tests/ResourceManagerTests.cs @@ -156,7 +156,7 @@ namespace System.Resources.Tests }).Dispose(); } - public static void Remote_ExpectEvents() + private static void Remote_ExpectEvents() { #if netcoreapp System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += AssemblyResolvingEventHandler; diff --git a/src/libraries/System.Resources.ResourceManager/tests/SatelliteContractVersionAttributeTests.cs b/src/libraries/System.Resources.ResourceManager/tests/SatelliteContractVersionAttributeTests.cs index 8b52620755e..6809279005f 100644 --- a/src/libraries/System.Resources.ResourceManager/tests/SatelliteContractVersionAttributeTests.cs +++ b/src/libraries/System.Resources.ResourceManager/tests/SatelliteContractVersionAttributeTests.cs @@ -19,6 +19,7 @@ namespace System.Resources.Tests Assert.Equal(version, scva.Version); } + [Fact] public static void ConstructorArgumentNull() { Assert.Throws(() => new SatelliteContractVersionAttribute(null)); diff --git a/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj b/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj index 38f5cf5a705..1f5e5bec84f 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj +++ b/src/libraries/System.Runtime.Extensions/tests/System.Runtime.Extensions.Tests.csproj @@ -5,6 +5,8 @@ $(DefineConstants);Unix true true + + true netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.cs index 6473c9f4add..49d915e7db7 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/ComAwareEventInfoTests.cs @@ -92,7 +92,7 @@ namespace System.Runtime.InteropServices.Tests public bool CalledEventHandler { get; set; } - public void EventHandler(object sender, EventArgs e) + private void EventHandler(object sender, EventArgs e) { Assert.False(CalledEventHandler); CalledEventHandler = true; @@ -101,7 +101,7 @@ namespace System.Runtime.InteropServices.Tests Assert.Null(e); } - public class NonComObject + internal class NonComObject { [ExcludeFromCodeCoverage] public event EventHandler Event; diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ChangeWrapperHandleStrengthTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ChangeWrapperHandleStrengthTests.cs index 0826915ad9d..f03ebe5a718 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ChangeWrapperHandleStrengthTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ChangeWrapperHandleStrengthTests.cs @@ -29,7 +29,7 @@ namespace System.Runtime.InteropServices.Tests yield return new object[] { new int[][] { new int[] { 10 } } }; yield return new object[] { new int[,] { { 10 } } }; - MethodInfo method = typeof(ChangeWrapperHandleStrengthTests).GetMethod(nameof(NonGenericMethod)); + MethodInfo method = typeof(ChangeWrapperHandleStrengthTests).GetMethod(nameof(NonGenericMethod), BindingFlags.Static | BindingFlags.NonPublic); Delegate d = method.CreateDelegate(typeof(NonGenericDelegate)); yield return new object[] { d }; } @@ -59,9 +59,9 @@ namespace System.Runtime.InteropServices.Tests Assert.Throws(() => Marshal.ChangeWrapperHandleStrength(null, fIsWeak: false)); } - public static void NonGenericMethod(int i) { } - public delegate void NonGenericDelegate(int i); + private static void NonGenericMethod(int i) { } + private delegate void NonGenericDelegate(int i); - public enum Int32Enum : int { Value1, Value2 } + internal enum Int32Enum : int { Value1, Value2 } } } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.cs index ee895a132fe..217c3565e4a 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetDelegateForFunctionPointerTests.cs @@ -19,7 +19,7 @@ namespace System.Runtime.InteropServices.Tests [InlineData(typeof(OtherNonGenericDelegate))] public void GetDelegateForFunctionPointer_NonGeneric_ReturnsExpected(Type t) { - MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d); @@ -31,7 +31,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetDelegateForFunctionPointer_CollectibleType_ReturnsExpected() { - MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d); @@ -54,7 +54,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetDelegateForFunctionPointer_Generic_ReturnsExpected() { - MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d); @@ -66,7 +66,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetDelegateForFunctionPointer_GenericInvalidType_ReturnsExpected() { - MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d); @@ -132,7 +132,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetDelegateForFunctionPointer_CantCast_ThrowsInvalidCastException() { - MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetDelegateForFunctionPointerTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr ptr = Marshal.GetFunctionPointerForDelegate(d); @@ -144,6 +144,6 @@ namespace System.Runtime.InteropServices.Tests public delegate void NonGenericDelegate(string t); public delegate void OtherNonGenericDelegate(string t); - public static void Method(string s) { } + private static void Method(string s) { } } } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs index 0c4afecd043..a200dc19d9f 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetFunctionPointerForDelegateTests.cs @@ -14,7 +14,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetFunctionPointerForDelegate_NormalDelegateNonGeneric_ReturnsExpected() { - MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr pointer1 = Marshal.GetFunctionPointerForDelegate(d); @@ -26,7 +26,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetFunctionPointerForDelegate_MarshalledDelegateNonGeneric_ReturnsExpected() { - MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate original = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr ptr = Marshal.GetFunctionPointerForDelegate(original); Delegate d = Marshal.GetDelegateForFunctionPointer(ptr); @@ -42,7 +42,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetFunctionPointerForDelegate_NormalDelegateGeneric_ReturnsExpected() { - MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); NonGenericDelegate d = (NonGenericDelegate)targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr pointer1 = Marshal.GetFunctionPointerForDelegate(d); @@ -54,7 +54,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetFunctionPointerForDelegate_MarshalledDelegateGeneric_ReturnsExpected() { - MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate original = targetMethod.CreateDelegate(typeof(NonGenericDelegate)); IntPtr ptr = Marshal.GetFunctionPointerForDelegate(original); NonGenericDelegate d = Marshal.GetDelegateForFunctionPointer(ptr); @@ -83,7 +83,7 @@ namespace System.Runtime.InteropServices.Tests [Fact] public void GetFunctionPointer_GenericDelegate_ThrowsArgumentException() { - MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method)); + MethodInfo targetMethod = typeof(GetFunctionPointerForDelegateTests).GetMethod(nameof(Method), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = targetMethod.CreateDelegate(typeof(GenericDelegate)); AssertExtensions.Throws("delegate", () => Marshal.GetFunctionPointerForDelegate(d)); } @@ -91,6 +91,6 @@ namespace System.Runtime.InteropServices.Tests public delegate void GenericDelegate(T t); public delegate void NonGenericDelegate(string t); - public static void Method(string s) { } + private static void Method(string s) { } } } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetNativeVariantForObjectTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetNativeVariantForObjectTests.cs index 14cf3e2edd7..b7e0a7bf72e 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetNativeVariantForObjectTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetNativeVariantForObjectTests.cs @@ -76,7 +76,7 @@ namespace System.Runtime.InteropServices.Tests yield return new object[] { new object[] { valueType, null }, (VarEnum)8204, (IntPtr)(-1) }; // Delegate. - MethodInfo method = typeof(GetNativeVariantForObjectTests).GetMethod(nameof(NonGenericMethod)); + MethodInfo method = typeof(GetNativeVariantForObjectTests).GetMethod(nameof(NonGenericMethod), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = method.CreateDelegate(typeof(NonGenericDelegate)); yield return new object[] { d, VarEnum.VT_DISPATCH, (IntPtr)(-1) }; } @@ -444,7 +444,7 @@ namespace System.Runtime.InteropServices.Tests public enum UInt32Enum : uint { Value1, Value2 } public enum UInt64Enum : ulong { Value1, Value2 } - public static void NonGenericMethod(int i) { } + private static void NonGenericMethod(int i) { } public delegate void NonGenericDelegate(int i); public class FakeSafeHandle : SafeHandle diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetObjectForIUnknownTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetObjectForIUnknownTests.cs index 26deb93ee48..57151055310 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetObjectForIUnknownTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetObjectForIUnknownTests.cs @@ -28,7 +28,7 @@ namespace System.Runtime.InteropServices.Tests yield return new object[] { new int[][] { new int[] { 10 } } }; yield return new object[] { new int[,] { { 10 } } }; - MethodInfo method = typeof(GetObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod)); + MethodInfo method = typeof(GetObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = method.CreateDelegate(typeof(NonGenericDelegate)); yield return new object[] { d }; @@ -66,7 +66,7 @@ namespace System.Runtime.InteropServices.Tests AssertExtensions.Throws("pUnk", () => Marshal.GetObjectForIUnknown(IntPtr.Zero)); } - public static void NonGenericMethod(int i) { } + private static void NonGenericMethod(int i) { } public delegate void NonGenericDelegate(int i); public enum Int32Enum : int { Value1, Value2 } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetTypedObjectForIUnknownTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetTypedObjectForIUnknownTests.cs index 82eedbcc230..fe0b5a32c06 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetTypedObjectForIUnknownTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetTypedObjectForIUnknownTests.cs @@ -22,7 +22,7 @@ namespace System.Runtime.InteropServices.Tests yield return new NonGenericStruct(); yield return Int32Enum.Value1; - MethodInfo method = typeof(GetTypedObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod)); + MethodInfo method = typeof(GetTypedObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = method.CreateDelegate(typeof(NonGenericDelegate)); yield return d; } @@ -201,7 +201,7 @@ namespace System.Runtime.InteropServices.Tests public class ClassWithInterface : NonGenericInterface { } public struct StructWithInterface : NonGenericInterface { } - public static void NonGenericMethod(int i) { } + private static void NonGenericMethod(int i) { } public delegate void NonGenericDelegate(int i); public enum Int32Enum : int { Value1, Value2 } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetUniqueObjectForIUnknownTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetUniqueObjectForIUnknownTests.cs index 02c04d67d14..1da3b1529af 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetUniqueObjectForIUnknownTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/GetUniqueObjectForIUnknownTests.cs @@ -28,7 +28,7 @@ namespace System.Runtime.InteropServices.Tests yield return new object[] { new int[][] { new int[] { 10 } } }; yield return new object[] { new int[,] { { 10 } } }; - MethodInfo method = typeof(GetUniqueObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod)); + MethodInfo method = typeof(GetUniqueObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = method.CreateDelegate(typeof(NonGenericDelegate)); yield return new object[] { d }; @@ -66,7 +66,7 @@ namespace System.Runtime.InteropServices.Tests AssertExtensions.Throws("pUnk", () => Marshal.GetUniqueObjectForIUnknown(IntPtr.Zero)); } - public static void NonGenericMethod(int i) { } + private static void NonGenericMethod(int i) { } public delegate void NonGenericDelegate(int i); public enum Int32Enum : int { Value1, Value2 } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/IsComObjectTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/IsComObjectTests.cs index fe15dbdf343..d58f0f30bdf 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/IsComObjectTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/IsComObjectTests.cs @@ -29,7 +29,7 @@ namespace System.Runtime.InteropServices.Tests yield return new object[] { new int[][] { new int[] { 10 } } }; yield return new object[] { new int[,] { { 10 } } }; - MethodInfo method = typeof(IsComObjectTests).GetMethod(nameof(NonGenericMethod)); + MethodInfo method = typeof(IsComObjectTests).GetMethod(nameof(NonGenericMethod), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = method.CreateDelegate(typeof(NonGenericDelegate)); yield return new object[] { d }; @@ -67,7 +67,7 @@ namespace System.Runtime.InteropServices.Tests AssertExtensions.Throws("o", () => Marshal.IsComObject(null)); } - public static void NonGenericMethod(int i) { } + private static void NonGenericMethod(int i) { } public delegate void NonGenericDelegate(int i); public enum Int32Enum : int { Value1, Value2 } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs index 970e61b3308..083b986dbe8 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs @@ -69,7 +69,7 @@ namespace System.Runtime.InteropServices.Tests yield return new object[] { new int[,] { { 10 } }, IID_IUNKNOWN }; yield return new object[] { new int[,] { { 10 } }, IID_IINSPECTABLE }; - MethodInfo method = typeof(GetObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod)); + MethodInfo method = typeof(GetObjectForIUnknownTests).GetMethod(nameof(NonGenericMethod), BindingFlags.NonPublic | BindingFlags.Static); Delegate d = method.CreateDelegate(typeof(NonGenericDelegate)); yield return new object[] { d, IID_IUNKNOWN }; yield return new object[] { d, IID_IDISPATCH }; @@ -157,7 +157,7 @@ namespace System.Runtime.InteropServices.Tests AssertExtensions.Throws("pUnk", () => Marshal.QueryInterface(IntPtr.Zero, ref iid, out IntPtr ppv)); } - public static void NonGenericMethod(int i) { } + private static void NonGenericMethod(int i) { } public delegate void NonGenericDelegate(int i); public enum Int32Enum : int { Value1, Value2 } diff --git a/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs b/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs index b544279a119..ca96c367396 100644 --- a/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/DefaultContext/DefaultLoadContextTest.cs @@ -183,7 +183,7 @@ namespace System.Runtime.Loader.Tests () => AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName("System.Runtime.Loader.NonExistent.Assembly"))); } - public void DefaultContextFallback() + private void DefaultContextFallback() { var lcDefault = AssemblyLoadContext.Default; @@ -238,7 +238,7 @@ namespace System.Runtime.Loader.Tests Assert.Equal(typeof(FileNotFoundException), ex.GetType()); } - public void DefaultContextOverrideTPA() + private void DefaultContextOverrideTPA() { var lcDefault = AssemblyLoadContext.Default; diff --git a/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs b/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs index 6cf1d05c49e..eccc6f17244 100644 --- a/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs +++ b/src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs @@ -83,7 +83,7 @@ namespace System.Runtime.Loader.Tests DeleteDirectory(); } - public static void LoadRefEmitAssemblyInLoadContext(AssemblyLoadContext loadContext, AssemblyBuilderAccess builderType) + private static void LoadRefEmitAssemblyInLoadContext(AssemblyLoadContext loadContext, AssemblyBuilderAccess builderType) { // Load this assembly in custom LoadContext var assemblyNameStr = "System.Runtime.Loader.Noop.Assembly.dll"; diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/Comparison.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/Comparison.cs index f06231a74f1..2aa4ae2afe4 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/Comparison.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/Comparison.cs @@ -17,7 +17,7 @@ namespace System.Numerics.Tests RunTests(seed); } - public static void RunTests(int seed) + private static void RunTests(int seed) { Random random = new Random(seed); @@ -359,7 +359,7 @@ namespace System.Numerics.Tests Assert.Equal(false, BigInteger.Zero.Equals((object)"0")); } - public static void IComparable_Invalid(string paramName) + private static void IComparable_Invalid(string paramName) { IComparable comparable = new BigInteger(); Assert.Equal(1, comparable.CompareTo(null)); diff --git a/src/libraries/System.Runtime.Numerics/tests/BigInteger/parse.cs b/src/libraries/System.Runtime.Numerics/tests/BigInteger/parse.cs index e5b4c954d31..79e9c22ab5f 100644 --- a/src/libraries/System.Runtime.Numerics/tests/BigInteger/parse.cs +++ b/src/libraries/System.Runtime.Numerics/tests/BigInteger/parse.cs @@ -108,7 +108,7 @@ namespace System.Numerics.Tests VerifyFormatParse("123&4567^ <", NumberStyles.Any, nfi, new BigInteger(-1234567)); } - public static void VerifyDefaultParse(Random random) + private static void VerifyDefaultParse(Random random) { // BasicTests VerifyFailParseToString(null, typeof(ArgumentNullException)); @@ -229,7 +229,7 @@ namespace System.Numerics.Tests } } - public static void VerifyNumberStyles(NumberStyles ns, Random random) + private static void VerifyNumberStyles(NumberStyles ns, Random random) { VerifyParseToString(null, ns, false, null); VerifyParseToString(string.Empty, ns, false); @@ -763,7 +763,7 @@ namespace System.Numerics.Tests return (ns & NumberStyles.AllowTrailingWhite) != 0; } - public static void Eval(BigInteger x, string expected) + private static void Eval(BigInteger x, string expected) { bool IsPos = (x >= 0); if (!IsPos) diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs index 05dfed50c87..59676a9423b 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs @@ -58,22 +58,6 @@ namespace System.Runtime.Serialization.Formatters.Tests EqualityExtensions.CheckEquals(obj, clone, isSamePlatform: true); } - // Used for updating blobs in BinaryFormatterTestData.cs - //[Fact] - public void UpdateBlobs() - { - string testDataFilePath = GetTestDataFilePath(); - string[] coreTypeBlobs = SerializableEqualityComparers_MemberData() - .Concat(SerializableObjects_MemberData()) - .Select(record => BinaryFormatterHelpers.ToBase64String(record[0])) - .ToArray(); - - var (numberOfBlobs, numberOfFoundBlobs, numberOfUpdatedBlobs) = UpdateCoreTypeBlobs(testDataFilePath, coreTypeBlobs); - Console.WriteLine($"{numberOfBlobs} existing blobs" + - $"{Environment.NewLine}{numberOfFoundBlobs} found blobs with regex search" + - $"{Environment.NewLine}{numberOfUpdatedBlobs} updated blobs with regex replace"); - } - [Theory] [MemberData(nameof(SerializableObjects_MemberData))] public void ValidateAgainstBlobs(object obj, TypeSerializableValue[] blobs) @@ -438,11 +422,9 @@ namespace System.Runtime.Serialization.Formatters.Tests Assert.Equal(42, real); } - // Test is disabled becaues it can cause improbable memory allocations leading to interminable paging. - // We're keeping the code because it could be useful to a dev making local changes to binary formatter code. - //[OuterLoop] - //[Theory] - //[MemberData(nameof(FuzzInputs_MemberData))] + [OuterLoop] + [Theory(Skip = "Can cause improbable memory allocations leading to interminable paging")] + [MemberData(nameof(FuzzInputs_MemberData))] public void Deserialize_FuzzInput(object obj, Random rand) { // Get the serialized data for the object diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs b/src/libraries/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs index 8916788d9b6..6aa603b23fd 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/FormatterServicesTests.cs @@ -171,7 +171,7 @@ namespace System.Runtime.Serialization.Formatters.Tests Assert.Equal(0, nullableSafe.Value); } - [Theory] + [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "The full .NET Framework doesn't support GetUninitializedObject for subclasses of ContextBoundObject")] public void GetUninitializedObject_ContextBoundObjectSubclass_NetCore_InitializesValue() { diff --git a/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs b/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs index d1b5913ddb0..32f445dadf5 100644 --- a/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs +++ b/src/libraries/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs @@ -1678,6 +1678,7 @@ public static partial class DataContractJsonSerializerTests Assert.StrictEqual(value.StringValue, deserializedValue.StringValue); } + [Fact] public static void DCJS_SerializationEvents() { var input = new MyType() { Value = "string value" }; diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs index ef276bff194..ed67ee4d1cc 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs @@ -2419,16 +2419,6 @@ public static partial class DataContractSerializerTests Assert.StrictEqual(true, Enumerable.SequenceEqual(value, deserialized)); } - //[Fact] - // This also fails without using reflection based fallback - public static void DCS_GenericICollectionOfDateTime() - { - var value = new TypeImplementsGenericICollection() { new DateTime(2000, 1, 2, 3, 4, 5), new DateTime(2011, 2, 3, 4, 5, 6) }; - var deserialized = DataContractSerializerHelper.SerializeAndDeserialize(value, @"2000-01-02T03:04:05-08:002011-02-03T04:05:06-08:00"); - Assert.StrictEqual(value.Count, deserialized.Count); - Assert.StrictEqual(true, Enumerable.SequenceEqual(value, deserialized)); - } - [Fact] public static void DCS_GenericICollectionOfDecimal() { diff --git a/src/libraries/System.Runtime/tests/System/ArrayTests.cs b/src/libraries/System.Runtime/tests/System/ArrayTests.cs index 5a7834cc189..87a7a77abb9 100644 --- a/src/libraries/System.Runtime/tests/System/ArrayTests.cs +++ b/src/libraries/System.Runtime/tests/System/ArrayTests.cs @@ -3137,7 +3137,7 @@ namespace System.Tests } } - public static void Reverse(Array array, int index, int length, Array expected) + private static void Reverse(Array array, int index, int length, Array expected) { if (index == array.GetLowerBound(0) && length == array.Length) { diff --git a/src/libraries/System.Runtime/tests/System/DateTimeTests.cs b/src/libraries/System.Runtime/tests/System/DateTimeTests.cs index 4b2aa5991da..9b7dccb4dfa 100644 --- a/src/libraries/System.Runtime/tests/System/DateTimeTests.cs +++ b/src/libraries/System.Runtime/tests/System/DateTimeTests.cs @@ -1539,6 +1539,7 @@ namespace System.Tests Assert.False(DateTime.TryParseExact(" ", "%t", englishCulture, DateTimeStyles.None, out _)); } + [Fact] public static void ParseExact_EscapedSingleQuotes() { var formatInfo = DateTimeFormatInfo.GetInstance(new CultureInfo("mt-MT")); diff --git a/src/libraries/System.Runtime/tests/System/DecimalTests.cs b/src/libraries/System.Runtime/tests/System/DecimalTests.cs index 62162e9647e..7e42c04e4a1 100644 --- a/src/libraries/System.Runtime/tests/System/DecimalTests.cs +++ b/src/libraries/System.Runtime/tests/System/DecimalTests.cs @@ -158,6 +158,7 @@ namespace System.Tests AssertExtensions.Throws(null, () => new decimal(bits)); } + [Theory] [InlineData(int.MinValue)] [InlineData(0)] [InlineData(int.MaxValue)] diff --git a/src/libraries/System.Runtime/tests/System/EnumTests.cs b/src/libraries/System.Runtime/tests/System/EnumTests.cs index 7dff6c73260..af6b3ed63d8 100644 --- a/src/libraries/System.Runtime/tests/System/EnumTests.cs +++ b/src/libraries/System.Runtime/tests/System/EnumTests.cs @@ -220,11 +220,11 @@ namespace System.Tests public static void Parse_Invalid(Type enumType, string value, bool ignoreCase, Type exceptionType) { Type typeArgument = enumType == null || !enumType.GetTypeInfo().IsEnum ? typeof(SimpleEnum) : enumType; - MethodInfo parseMethod = typeof(EnumTests).GetTypeInfo().GetMethod(nameof(Parse_Generic_Invalid)).MakeGenericMethod(typeArgument); + MethodInfo parseMethod = typeof(EnumTests).GetTypeInfo().GetMethod(nameof(Parse_Generic_Invalid), BindingFlags.Static | BindingFlags.NonPublic).MakeGenericMethod(typeArgument); parseMethod.Invoke(null, new object[] { enumType, value, ignoreCase, exceptionType }); } - public static void Parse_Generic_Invalid(Type enumType, string value, bool ignoreCase, Type exceptionType) where T : struct + private static void Parse_Generic_Invalid(Type enumType, string value, bool ignoreCase, Type exceptionType) where T : struct { T result; if (!ignoreCase) diff --git a/src/libraries/System.Runtime/tests/System/EnumTests.netcoreapp.cs b/src/libraries/System.Runtime/tests/System/EnumTests.netcoreapp.cs index fd0d81cd298..0ba4dc4920b 100644 --- a/src/libraries/System.Runtime/tests/System/EnumTests.netcoreapp.cs +++ b/src/libraries/System.Runtime/tests/System/EnumTests.netcoreapp.cs @@ -35,11 +35,11 @@ namespace System.Tests public static void Parse_Invalid_NetCoreApp11(Type enumType, string value, bool ignoreCase, Type exceptionType) { Type typeArgument = enumType == null || !enumType.IsValueType ? typeof(SimpleEnum) : enumType; - MethodInfo parseMethod = typeof(EnumTests).GetTypeInfo().GetMethod(nameof(Parse_Generic_Invalid_NetCoreApp11)).MakeGenericMethod(typeArgument); + MethodInfo parseMethod = typeof(EnumTests).GetTypeInfo().GetMethod(nameof(Parse_Generic_Invalid_NetCoreApp11), BindingFlags.Static | BindingFlags.NonPublic).MakeGenericMethod(typeArgument); parseMethod.Invoke(null, new object[] { enumType, value, ignoreCase, exceptionType }); } - public static void Parse_Generic_Invalid_NetCoreApp11(Type enumType, string value, bool ignoreCase, Type exceptionType) where T : struct + private static void Parse_Generic_Invalid_NetCoreApp11(Type enumType, string value, bool ignoreCase, Type exceptionType) where T : struct { object result = null; if (!ignoreCase) diff --git a/src/libraries/System.Runtime/tests/System/ExternalExceptionTests.cs b/src/libraries/System.Runtime/tests/System/ExternalExceptionTests.cs index 37335fa236b..2a6fcacae30 100644 --- a/src/libraries/System.Runtime/tests/System/ExternalExceptionTests.cs +++ b/src/libraries/System.Runtime/tests/System/ExternalExceptionTests.cs @@ -42,13 +42,14 @@ namespace System.Runtime.InteropServices.Tests Assert.Equal(COR_E_EXTERNAL, exception.HResult); } + [Fact] public static void Ctor_String_int() { string msg = "Created ExternalException"; int errorCode = -2000607220; ExternalException exception = new ExternalException(msg, errorCode); Assert.Equal(msg, exception.Message); - Assert.Equal(COR_E_EXTERNAL, exception.HResult); + Assert.Equal(errorCode, exception.HResult); } } } \ No newline at end of file diff --git a/src/libraries/System.Runtime/tests/System/GCTests.cs b/src/libraries/System.Runtime/tests/System/GCTests.cs index 4da6b17fc32..58d1737acbf 100644 --- a/src/libraries/System.Runtime/tests/System/GCTests.cs +++ b/src/libraries/System.Runtime/tests/System/GCTests.cs @@ -741,7 +741,7 @@ namespace System.Tests }, size.ToString(), options).Dispose(); } - public static void TestWait(bool approach, int timeout) + private static void TestWait(bool approach, int timeout) { GCNotificationStatus result = GCNotificationStatus.Failed; Thread cancelProc = null; @@ -786,7 +786,7 @@ namespace System.Tests } } - public static void CancelProc() + private static void CancelProc() { Thread.Sleep(500); GC.CancelFullGCNotification(); diff --git a/src/libraries/System.Runtime/tests/System/GuidTests.cs b/src/libraries/System.Runtime/tests/System/GuidTests.cs index b86e7713e39..dc3fcb37484 100644 --- a/src/libraries/System.Runtime/tests/System/GuidTests.cs +++ b/src/libraries/System.Runtime/tests/System/GuidTests.cs @@ -160,12 +160,6 @@ namespace System.Tests Assert.Equal(expected, result3); } - [Theory] - public static void Parse_Invalid_NetcoreApp(string input, Type exceptionType) - { - Parse_Invalid(input, exceptionType); - } - [Theory] [MemberData(nameof(GuidStrings_Invalid_TestData))] public static void Parse_Invalid(string input, Type exceptionType) diff --git a/src/libraries/System.Runtime/tests/System/LazyOfTMetadataTests.cs b/src/libraries/System.Runtime/tests/System/LazyOfTMetadataTests.cs index d72425c896e..4c8e7745edd 100644 --- a/src/libraries/System.Runtime/tests/System/LazyOfTMetadataTests.cs +++ b/src/libraries/System.Runtime/tests/System/LazyOfTMetadataTests.cs @@ -82,7 +82,7 @@ namespace System.Tests AssertExtensions.Throws("mode", () => new Lazy(() => 42, "test", LazyThreadSafetyMode.ExecutionAndPublication + 1)); // Invalid mode } - public static void VerifyLazy(Lazy lazy, T expectedValue, TMetadata expectedMetadata) + private static void VerifyLazy(Lazy lazy, T expectedValue, TMetadata expectedMetadata) { // Accessing metadata doesn't create the value Assert.False(lazy.IsValueCreated); diff --git a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs index f3444478e89..c2b6329d887 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs @@ -15,7 +15,7 @@ namespace System.Reflection.Tests { AssertExtensions.Throws("memberInfo", () => new CustomAttributeNamedArgument(null, null)); - MethodInfo m = typeof(CustomAttribute_Named_Typed_ArgumentTests).GetMethod("MyMethod"); + MethodInfo m = typeof(CustomAttribute_Named_Typed_ArgumentTests).GetMethod("MyMethod", BindingFlags.Static | BindingFlags.NonPublic); foreach (CustomAttributeData cad in CustomAttributeData.GetCustomAttributes(m)) { foreach (CustomAttributeTypedArgument cata in cad.ConstructorArguments) @@ -54,7 +54,7 @@ namespace System.Reflection.Tests } [MyAttr(MyKinds.First, Desc = "This is a description on a method")] - public static void MyMethod() { } + private static void MyMethod() { } } internal enum MyKinds { diff --git a/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.cs index 7e6c3553438..0bbc3de15d7 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.cs @@ -107,6 +107,7 @@ namespace System.Reflection.Tests return x+1; } +#pragma warning disable xUnit1013 // Public method should be marked as test public static void MyOtherMethod(object arg) { int var1 = 2; @@ -117,5 +118,6 @@ namespace System.Reflection.Tests throw new ArgumentNullException("Input arg cannot be null."); } } +#pragma warning restore xUnit1013 // Public method should be marked as test } } \ No newline at end of file diff --git a/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.netcoreapp.cs b/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.netcoreapp.cs index 54a49522694..643e372f4bf 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.netcoreapp.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/MethodBaseTests.netcoreapp.cs @@ -11,7 +11,7 @@ namespace System.Reflection.Tests [Fact] public static void Test_GetCurrentMethod_ConstructedGenericMethod() { - MethodInfo mi = typeof(MethodBaseNetcoreTests).GetMethod(nameof(MyFakeGenericMethod)); + MethodInfo mi = typeof(MethodBaseNetcoreTests).GetMethod(nameof(MyFakeGenericMethod), BindingFlags.NonPublic | BindingFlags.Instance); MethodBase m = mi.MakeGenericMethod(typeof(byte)); Assert.Equal(nameof(MyFakeGenericMethod), m.Name); @@ -26,7 +26,7 @@ namespace System.Reflection.Tests [Fact] public static void Test_GetCurrentMethod_GenericMethodDefinition() { - MethodBase m = typeof(MethodBaseNetcoreTests).GetMethod(nameof(MyFakeGenericMethod)); + MethodBase m = typeof(MethodBaseNetcoreTests).GetMethod(nameof(MyFakeGenericMethod), BindingFlags.NonPublic | BindingFlags.Instance); Assert.Equal(nameof(MyFakeGenericMethod), m.Name); Assert.Equal(typeof(MethodBaseNetcoreTests), m.ReflectedType); @@ -37,7 +37,7 @@ namespace System.Reflection.Tests Assert.Equal("T", m.GetGenericArguments()[0].Name); } - public void MyFakeGenericMethod() + private void MyFakeGenericMethod() { } } diff --git a/src/libraries/System.Runtime/tests/System/Reflection/MethodBodyTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/MethodBodyTests.cs index fcfdcd9de1a..20dc04ac8f5 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/MethodBodyTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/MethodBodyTests.cs @@ -15,7 +15,7 @@ namespace System.Reflection.Tests [Fact] public static void Test_MethodBody_ExceptionHandlingClause() { - MethodInfo mi = typeof(MethodBodyTests).GetMethod("MethodBodyExample"); + MethodInfo mi = typeof(MethodBodyTests).GetMethod("MethodBodyExample", BindingFlags.NonPublic | BindingFlags.Static); MethodBody mb = mi.GetMethodBody(); Assert.True(mb.InitLocals); // local variables are initialized @@ -72,7 +72,7 @@ namespace System.Reflection.Tests Assert.True(false, "Expected to find CatchType clause."); } - public static void MethodBodyExample(object arg) + private static void MethodBodyExample(object arg) { int var1 = 2; string var2 = "I am a string"; diff --git a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs index a43f0ac5efc..0ee6581136a 100644 --- a/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs @@ -2324,7 +2324,7 @@ namespace System.Tests VerifyTimeSpanArray(ret, expectedOffsets, string.Format("Wrong offsets when used {0} with the zone {1}", dt, tz.Id)); } - public static void VerifyTimeSpanArray(TimeSpan[] actual, TimeSpan[] expected, string errorMsg) + private static void VerifyTimeSpanArray(TimeSpan[] actual, TimeSpan[] expected, string errorMsg) { Assert.True(actual != null); Assert.True(expected != null); diff --git a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs index ee5e1c67417..fc677fdbbf8 100644 --- a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs +++ b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs @@ -278,11 +278,12 @@ namespace System.Tests Assert.Equal(typeCode, Type.GetTypeCode(t)); } + [Fact] public void ReflectionOnlyGetType() { - AssertExtensions.Throws("typeName", () => Type.ReflectionOnlyGetType(null, true, false)); - Assert.Throws(() => Type.ReflectionOnlyGetType("", true, true)); - Assert.Throws(() => Type.ReflectionOnlyGetType("System.Tests.TypeTests", false, true)); + Assert.Throws(() => Type.ReflectionOnlyGetType(null, true, false)); + Assert.Throws(() => Type.ReflectionOnlyGetType("", true, true)); + Assert.Throws(() => Type.ReflectionOnlyGetType("System.Tests.TypeTests", false, true)); } } diff --git a/src/libraries/System.Runtime/tests/System/Uri.CreateStringTests.cs b/src/libraries/System.Runtime/tests/System/Uri.CreateStringTests.cs index bdc34d1e9e1..576e6ddfc5c 100644 --- a/src/libraries/System.Runtime/tests/System/Uri.CreateStringTests.cs +++ b/src/libraries/System.Runtime/tests/System/Uri.CreateStringTests.cs @@ -982,6 +982,8 @@ namespace System.Tests yield return new object[] { @"\\servername\sharename\path\filename", false }; } + [Theory] + [MemberData(nameof(Relative_TestData))] public void Relative(string uriString, bool relativeOrAbsolute) { PerformAction(uriString, UriKind.Relative, uri => @@ -1253,7 +1255,7 @@ namespace System.Tests Assert.Null(uri); } - public static void PerformAction(string uriString, UriKind uriKind, Action action) + private static void PerformAction(string uriString, UriKind uriKind, Action action) { if (uriKind == UriKind.Absolute) { @@ -1269,7 +1271,7 @@ namespace System.Tests action(result); } - public static void VerifyRelativeUri(Uri uri, string originalString, string toString) + internal static void VerifyRelativeUri(Uri uri, string originalString, string toString) { Assert.Equal(originalString, uri.OriginalString); Assert.Equal(toString, uri.ToString()); diff --git a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs b/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs index 224929c5984..3117652e28a 100644 --- a/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs +++ b/src/libraries/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs @@ -382,6 +382,7 @@ namespace System.Security.Cryptography.DeriveBytesTests } #endif + [Fact] public static void CryptDeriveKey_NotSupported() { using (var deriveBytes = new Rfc2898DeriveBytes(TestPassword, s_testSalt)) diff --git a/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs b/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs index bd1b5e21e66..718a5c6b5f2 100644 --- a/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs +++ b/src/libraries/System.Security.Cryptography.Csp/tests/CspParametersTests.cs @@ -46,8 +46,7 @@ namespace System.Security.Cryptography.Csp.Tests } } - //Manual test - requires Smart Card - read instructions - //[Theory] + [Theory(Skip = "Manual test - requires Smart Card - read instructions")] [InlineData(true)] [InlineData(false)] public static void KeyPassword_SmartCard_Manual_Test(bool correctPassword) diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/StateTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/StateTests.cs index 3c582a248d5..b6d93aef7db 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/StateTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/StateTests.cs @@ -200,7 +200,7 @@ namespace System.Security.Cryptography.Pkcs.EnvelopedCmsTests.Tests // State 3: Called Decode() // - public static void PostDecode_Encode(bool isRunningOnDesktop) + private static void PostDecode_Encode(bool isRunningOnDesktop) { byte[] encodedMessage = ("3082010c06092a864886f70d010703a081fe3081fb0201003181c83081c5020100302e301a311830160603550403130f5253" @@ -234,7 +234,7 @@ namespace System.Security.Cryptography.Pkcs.EnvelopedCmsTests.Tests PostDecode_Encode(isRunningOnDesktop: false); } - public static void PostDecode_ContentInfo(bool isRunningOnDesktop) + private static void PostDecode_ContentInfo(bool isRunningOnDesktop) { byte[] encodedMessage = ("3082010c06092a864886f70d010703a081fe3081fb0201003181c83081c5020100302e301a311830160603550403130f5253" diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs index e922cb33269..1691162950a 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs @@ -915,6 +915,7 @@ namespace System.Security.Cryptography.X509Certificates.Tests } } + [Fact] public static void X509ChainElementCollection_CopyTo_NonZeroLowerBound_ThrowsIndexOutOfRangeException() { using (var microsoftDotCom = new X509Certificate2(TestData.MicrosoftDotComSslCertBytes)) diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingAsymmetric.cs b/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingAsymmetric.cs index 27f4144edb2..804dd5a58f0 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingAsymmetric.cs +++ b/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingAsymmetric.cs @@ -71,7 +71,7 @@ namespace System.Security.Cryptography.Xml.Tests } } - public static void Decrypt(XmlDocument doc, RSA rsaKey, string keyName) + private static void Decrypt(XmlDocument doc, RSA rsaKey, string keyName) { var encrypted = new EncryptedXml(doc); encrypted.AddKeyNameMapping(keyName, rsaKey); diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingSymmetricKeyWrap.cs b/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingSymmetricKeyWrap.cs index fd7d497821b..d4c3da7c8f0 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingSymmetricKeyWrap.cs +++ b/src/libraries/System.Security.Cryptography.Xml/tests/Samples/EncryptingDecryptingSymmetricKeyWrap.cs @@ -67,7 +67,7 @@ namespace System.Security.Cryptography.Xml.Tests } } - public static void Decrypt(XmlDocument doc, SymmetricAlgorithm key, string keyName) + private static void Decrypt(XmlDocument doc, SymmetricAlgorithm key, string keyName) { var encrypted = new EncryptedXml(doc); encrypted.AddKeyNameMapping(keyName, key); diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/XmlDsigC14NTransformTest.cs b/src/libraries/System.Security.Cryptography.Xml/tests/XmlDsigC14NTransformTest.cs index af546af4a98..200847819a9 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/XmlDsigC14NTransformTest.cs +++ b/src/libraries/System.Security.Cryptography.Xml/tests/XmlDsigC14NTransformTest.cs @@ -53,7 +53,7 @@ namespace System.Security.Cryptography.Xml.Tests CheckProperties(transform); } - public void CheckProperties(XmlDsigC14NTransform transform) + private static void CheckProperties(XmlDsigC14NTransform transform) { Assert.Null(transform.Context); Assert.Equal(new[] { typeof(Stream), typeof(XmlDocument), typeof(XmlNodeList) }, transform.InputTypes); diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/XmlLicenseEncryptedRef.cs b/src/libraries/System.Security.Cryptography.Xml/tests/XmlLicenseEncryptedRef.cs index 9eafa61bf47..7a7d9bf3e8d 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/XmlLicenseEncryptedRef.cs +++ b/src/libraries/System.Security.Cryptography.Xml/tests/XmlLicenseEncryptedRef.cs @@ -17,11 +17,7 @@ namespace System.Security.Cryptography.Xml.Tests { List _asymmetricKeys = new List(); - public XmlLicenseEncryptedRef() - { - } - - public void AddAsymmetricKey(AsymmetricAlgorithm key) + internal void AddAsymmetricKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException(nameof(key)); @@ -158,7 +154,7 @@ namespace System.Security.Cryptography.Xml.Tests return new MemoryStream(decryptedContent); } - public static void Encrypt(Stream toEncrypt, RSA key, out KeyInfo keyInfo, out EncryptionMethod encryptionMethod, out CipherData cipherData) + internal static void Encrypt(Stream toEncrypt, RSA key, out KeyInfo keyInfo, out EncryptionMethod encryptionMethod, out CipherData cipherData) { using (Aes sessionKey = Aes.Create()) { diff --git a/src/libraries/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs b/src/libraries/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs index 92ee4a489d5..c6c43dce26b 100644 --- a/src/libraries/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs +++ b/src/libraries/System.ServiceProcess.ServiceController/tests/ServiceBaseTests.cs @@ -41,11 +41,11 @@ namespace System.ServiceProcess.Tests } // [Fact] - // To cleanup lingering Test Services uncomment the Fact attribute and run the following command + // To cleanup lingering Test Services uncomment the Fact attribute, make it public and run the following command // msbuild /t:rebuildandtest /p:XunitMethodName=System.ServiceProcess.Tests.ServiceBaseTests.Cleanup /p:OuterLoop=true // Remember to comment out the Fact again before running tests otherwise it will cleanup tests running in parallel // and cause them to fail. - public void Cleanup() + private void Cleanup() { string currentService = ""; foreach (ServiceController controller in ServiceController.GetServices()) diff --git a/src/libraries/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs b/src/libraries/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs index d73034ced8b..ce93fd7889a 100644 --- a/src/libraries/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs +++ b/src/libraries/System.Text.Encoding.CodePages/tests/EncodingCodePages.cs @@ -633,7 +633,7 @@ namespace System.Text.Tests // This test is run as part of the default mappings test, since it modifies global state which that test // depends on. - public static void TestRegister1252() + private static void TestRegister1252() { // This test case ensure we can map all 1252 codepage codepoints without any exception. string s1252Result = diff --git a/src/libraries/System.Text.Encoding/tests/Encoding/EncodingConvertTests.cs b/src/libraries/System.Text.Encoding/tests/Encoding/EncodingConvertTests.cs index 1abdf4e9f11..99ae7114024 100644 --- a/src/libraries/System.Text.Encoding/tests/Encoding/EncodingConvertTests.cs +++ b/src/libraries/System.Text.Encoding/tests/Encoding/EncodingConvertTests.cs @@ -28,7 +28,7 @@ namespace System.Text.Tests } } - public void Convert(Encoding srcEncoding, Encoding dstEncoding, byte[] bytes, int index, int count, byte[] expected) + private static void Convert(Encoding srcEncoding, Encoding dstEncoding, byte[] bytes, int index, int count, byte[] expected) { if (index == 0 && count == bytes.Length) { diff --git a/src/libraries/System.Text.Encoding/tests/Encoding/EncodingCtorTests.cs b/src/libraries/System.Text.Encoding/tests/Encoding/EncodingCtorTests.cs index 69cd909838d..5e30e19142a 100644 --- a/src/libraries/System.Text.Encoding/tests/Encoding/EncodingCtorTests.cs +++ b/src/libraries/System.Text.Encoding/tests/Encoding/EncodingCtorTests.cs @@ -56,7 +56,7 @@ namespace System.Text.Tests Assert.Throws(() => encoding.WebName); } - public static void VerifyEncoding(Encoding encoding, int codePage, EncoderFallback encoderFallback, DecoderFallback decoderFallback) + private static void VerifyEncoding(Encoding encoding, int codePage, EncoderFallback encoderFallback, DecoderFallback decoderFallback) { if (encoderFallback == null) { diff --git a/src/libraries/System.Text.Encoding/tests/Latin1Encoding/Latin1EncodingEncode.cs b/src/libraries/System.Text.Encoding/tests/Latin1Encoding/Latin1EncodingEncode.cs index 6f581b91c1c..0a9e44c4da2 100644 --- a/src/libraries/System.Text.Encoding/tests/Latin1Encoding/Latin1EncodingEncode.cs +++ b/src/libraries/System.Text.Encoding/tests/Latin1Encoding/Latin1EncodingEncode.cs @@ -84,7 +84,7 @@ namespace System.Text.Tests Encode(source, index, count, GetBytes(source, index, count), valid: false); } - public void Encode(string source, int index, int count, byte[] expected, bool valid) + private static void Encode(string source, int index, int count, byte[] expected, bool valid) { EncodingHelpers.Encode(Encoding.GetEncoding("latin1"), source, index, count, expected); diff --git a/src/libraries/System.Text.Encoding/tests/NegativeEncodingTests.cs b/src/libraries/System.Text.Encoding/tests/NegativeEncodingTests.cs index e5ae72d3cf4..b9c162f1578 100644 --- a/src/libraries/System.Text.Encoding/tests/NegativeEncodingTests.cs +++ b/src/libraries/System.Text.Encoding/tests/NegativeEncodingTests.cs @@ -309,7 +309,7 @@ namespace System.Text.Tests AssertExtensions.Throws("bytes", () => encoding.GetString(new byte[1], 0, 2)); } - public static unsafe void Encode_Invalid(Encoding encoding, string chars, int index, int count) + internal static unsafe void Encode_Invalid(Encoding encoding, string chars, int index, int count) { Assert.Equal(EncoderFallback.ExceptionFallback, encoding.EncoderFallback); @@ -343,7 +343,7 @@ namespace System.Text.Tests } } - public static unsafe void Decode_Invalid(Encoding encoding, byte[] bytes, int index, int count) + internal static unsafe void Decode_Invalid(Encoding encoding, byte[] bytes, int index, int count) { Assert.Equal(DecoderFallback.ExceptionFallback, encoding.DecoderFallback); diff --git a/src/libraries/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs b/src/libraries/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs index 573b97fa1f1..8531a42b85f 100644 --- a/src/libraries/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs +++ b/src/libraries/System.Text.Encoding/tests/UTF32Encoding/UTF32EncodingTests.cs @@ -30,13 +30,13 @@ namespace System.Text.Tests Ctor_Bool_Bool_Bool(bigEndian, byteOrderMark, throwOnInvalidBytes: false); } - public void Ctor_Bool_Bool_Bool(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) + private static void Ctor_Bool_Bool_Bool(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) { UTF32Encoding encoding = new UTF32Encoding(bigEndian, byteOrderMark, throwOnInvalidBytes); VerifyUtf32Encoding(encoding, bigEndian, byteOrderMark, throwOnInvalidBytes); } - public static void VerifyUtf32Encoding(UTF32Encoding encoding, bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) + private static void VerifyUtf32Encoding(UTF32Encoding encoding, bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) { if (byteOrderMark) { diff --git a/src/libraries/System.Text.Encoding/tests/UTF7Encoding/UTF7EncodingTests.cs b/src/libraries/System.Text.Encoding/tests/UTF7Encoding/UTF7EncodingTests.cs index e1af8123b3b..3c8dc2db3e4 100644 --- a/src/libraries/System.Text.Encoding/tests/UTF7Encoding/UTF7EncodingTests.cs +++ b/src/libraries/System.Text.Encoding/tests/UTF7Encoding/UTF7EncodingTests.cs @@ -25,7 +25,7 @@ namespace System.Text.Tests VerifyUtf7Encoding(encoding, allowOptionals); } - public static void VerifyUtf7Encoding(UTF7Encoding encoding, bool allowOptionals) + private static void VerifyUtf7Encoding(UTF7Encoding encoding, bool allowOptionals) { Assert.Empty(encoding.GetPreamble()); diff --git a/src/libraries/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingTests.cs b/src/libraries/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingTests.cs index eebc21b4301..b5c505edef4 100644 --- a/src/libraries/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingTests.cs +++ b/src/libraries/System.Text.Encoding/tests/UTF8Encoding/UTF8EncodingTests.cs @@ -36,7 +36,7 @@ namespace System.Text.Tests VerifyUtf8Encoding(encoding, encoderShouldEmitUTF8Identifier, throwOnInvalidBytes); } - public static void VerifyUtf8Encoding(UTF8Encoding encoding, bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes) + private static void VerifyUtf8Encoding(UTF8Encoding encoding, bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes) { if (encoderShouldEmitUTF8Identifier) { diff --git a/src/libraries/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs b/src/libraries/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs index b3d5672ea46..50708abfe10 100644 --- a/src/libraries/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs +++ b/src/libraries/System.Text.Encoding/tests/UnicodeEncoding/UnicodeEncodingTests.cs @@ -30,13 +30,13 @@ namespace System.Text.Tests Ctor_Bool_Bool_Bool(bigEndian, byteOrderMark, throwOnInvalidBytes: false); } - public void Ctor_Bool_Bool_Bool(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) + private static void Ctor_Bool_Bool_Bool(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) { UnicodeEncoding encoding = new UnicodeEncoding(bigEndian, byteOrderMark, throwOnInvalidBytes); VerifyUnicodeEncoding(encoding, bigEndian, byteOrderMark, throwOnInvalidBytes); } - public static void VerifyUnicodeEncoding(UnicodeEncoding encoding, bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) + private static void VerifyUnicodeEncoding(UnicodeEncoding encoding, bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) { if (byteOrderMark) { diff --git a/src/libraries/System.Text.Json/tests/Serialization/Array.ReadTests.cs b/src/libraries/System.Text.Json/tests/Serialization/Array.ReadTests.cs index 3381b5d9131..a1648b80729 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/Array.ReadTests.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/Array.ReadTests.cs @@ -349,6 +349,7 @@ namespace System.Text.Json.Serialization.Tests TestClassWithGenericICollection obj = JsonSerializer.Deserialize(TestClassWithGenericICollection.s_data); } + [Fact] public static void ReadClassWithObjectISetT() { TestClassWithObjectISetT obj = JsonSerializer.Deserialize(TestClassWithObjectISetT.s_data); @@ -411,6 +412,7 @@ namespace System.Text.Json.Serialization.Tests obj.Verify(); } + [Fact] public static void ClassWithNoSetter() { string json = @"{""MyList"":[1]}"; diff --git a/src/libraries/System.Text.Json/tests/Serialization/Array.WriteTests.cs b/src/libraries/System.Text.Json/tests/Serialization/Array.WriteTests.cs index 7472f8183cb..23e756efba5 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/Array.WriteTests.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/Array.WriteTests.cs @@ -181,6 +181,7 @@ namespace System.Text.Json.Serialization.Tests } } + [Fact] public static void WriteClassWithGenericIEnumerableT() { string json; diff --git a/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.Exceptions.cs b/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.Exceptions.cs index 77298a538aa..eacd1295242 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.Exceptions.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/CustomConverterTests.Exceptions.cs @@ -22,7 +22,7 @@ namespace System.Text.Json.Serialization.Tests } } - public static void ConverterFailNoRethrow() where TException : Exception, new() + private static void ConverterFailNoRethrow() where TException : Exception, new() { var options = new JsonSerializerOptions(); JsonConverter converter = new FailConverter(); diff --git a/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.GenericCollections.cs b/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.GenericCollections.cs index 76a7104bec0..aa1a0dc28f9 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.GenericCollections.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.GenericCollections.cs @@ -729,9 +729,10 @@ namespace System.Text.Json.Serialization.Tests Assert.Throws(() => JsonSerializer.Deserialize>(@"{""Key"": ""Key"", ""Val"": 123")); } + [Fact] public static void ReadListOfKeyValuePair() { - List> input = JsonSerializer.Deserialize>>(@"""Key"":""Key"", ""Value"":[{""123"":123},{""456"": 456}]"); + List> input = JsonSerializer.Deserialize>>(@"[{""Key"": ""123"", ""Value"": 123},{""Key"": ""456"", ""Value"": 456}]"); Assert.Equal(2, input.Count); Assert.Equal("123", input[0].Key); @@ -740,9 +741,10 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal(456, input[1].Value); } + [Fact] public static void ReadKeyValuePairOfList() { - KeyValuePair> input = JsonSerializer.Deserialize>>(@"{""Key"":""Key"", Value:[1, 2, 3]}"); + KeyValuePair> input = JsonSerializer.Deserialize>>(@"{""Key"":""Key"", ""Value"":[1, 2, 3]}"); Assert.Equal("Key", input.Key); Assert.Equal(3, input.Value.Count); diff --git a/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.NonGenericCollections.cs b/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.NonGenericCollections.cs index 0323b42a0a8..4737396c6fd 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.NonGenericCollections.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/Value.ReadTests.NonGenericCollections.cs @@ -11,6 +11,7 @@ namespace System.Text.Json.Serialization.Tests { public static partial class ValueTests { + [Fact] public static void ReadGenericIEnumerableOfIEnumerable() { IEnumerable result = JsonSerializer.Deserialize>(Encoding.UTF8.GetBytes(@"[[1,2],[3,4]]")); @@ -77,6 +78,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal(0, count); } + [Fact] public static void ReadGenericIListOfIList() { IList result = JsonSerializer.Deserialize>(Encoding.UTF8.GetBytes(@"[[1,2],[3,4]]")); @@ -143,6 +145,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal(0, count); } + [Fact] public static void ReadGenericICollectionOfICollection() { ICollection result = JsonSerializer.Deserialize>(Encoding.UTF8.GetBytes(@"[[1,2],[3,4]]")); @@ -209,6 +212,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal(0, count); } + [Fact] public static void ReadGenericStackOfStack() { Stack result = JsonSerializer.Deserialize>(Encoding.UTF8.GetBytes(@"[[1,2],[3,4]]")); @@ -277,6 +281,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal(0, count); } + [Fact] public static void ReadGenericQueueOfQueue() { Queue result = JsonSerializer.Deserialize>(Encoding.UTF8.GetBytes(@"[[1,2],[3,4]]")); diff --git a/src/libraries/System.Text.Json/tests/Serialization/Value.WriteTests.NonGenericCollections.cs b/src/libraries/System.Text.Json/tests/Serialization/Value.WriteTests.NonGenericCollections.cs index 6acb43caafb..0bac5922055 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/Value.WriteTests.NonGenericCollections.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/Value.WriteTests.NonGenericCollections.cs @@ -23,6 +23,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal("[[1,2],[3,4]]", json); } + [Fact] public static void WriteGenericIEnumerableOfIEnumerable() { IEnumerable input = new List @@ -68,6 +69,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal("[[1,2],[3,4]]", json); } + [Fact] public static void WriteIListGenericOfIList() { IList input = new List @@ -113,6 +115,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal("[[1,2],[3,4]]", json); } + [Fact] public static void WriteGenericICollectionOfICollection() { ICollection input = new List @@ -156,6 +159,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal("[[4,3],[2,1]]", json); } + [Fact] public static void WriteGenericStackOfStack() { Stack input = new Stack(); @@ -197,6 +201,7 @@ namespace System.Text.Json.Serialization.Tests Assert.Equal("[[1,2],[3,4]]", json); } + [Fact] public static void WriteGenericQueueOfQueue() { Queue input = new Queue(); diff --git a/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs b/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs index 7e70b7d07e9..555162ec128 100644 --- a/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs +++ b/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs @@ -1515,7 +1515,7 @@ namespace System.Text.Json.Tests TryGetGuid_HasValueSequence_RetrievesGuid(testString, expectedString, isFinalBlock: false); } - public static void TryGetGuid_HasValueSequence_RetrievesGuid(string testString, string expectedString, bool isFinalBlock) + private static void TryGetGuid_HasValueSequence_RetrievesGuid(string testString, string expectedString, bool isFinalBlock) { byte[] dataUtf8 = Encoding.UTF8.GetBytes($"\"{testString}\""); ReadOnlySequence sequence = JsonTestHelper.GetSequence(dataUtf8, 1); diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs index 40247a2f498..54ea5f06f30 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs @@ -647,7 +647,7 @@ namespace System.Text.RegularExpressions.Tests return defaultCulture; } - public void Groups(string pattern, string input, RegexOptions options, string[] expectedGroups) + private static void Groups(string pattern, string input, RegexOptions options, string[] expectedGroups) { Regex regex = new Regex(pattern, options); Match match = regex.Match(input); diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs index 9ca5c39f740..8222d7e18ff 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.Match.Tests.cs @@ -345,7 +345,7 @@ namespace System.Text.RegularExpressions.Tests VerifyMatch(new Regex(pattern, options).Match(input, beginning, length), expectedSuccess, expectedValue); } - public static void VerifyMatch(Match match, bool expectedSuccess, string expectedValue) + private static void VerifyMatch(Match match, bool expectedSuccess, string expectedValue) { Assert.Equal(expectedSuccess, match.Success); Assert.Equal(expectedValue, match.Value); @@ -733,7 +733,7 @@ namespace System.Text.RegularExpressions.Tests } } - public static void VerifyMatch(Match match, bool expectedSuccess, CaptureData[] expected) + private static void VerifyMatch(Match match, bool expectedSuccess, CaptureData[] expected) { Assert.Equal(expectedSuccess, match.Success); diff --git a/src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs b/src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs index 0da289fe5a6..743404048b6 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/Regex.MultipleMatches.Tests.cs @@ -164,7 +164,7 @@ namespace System.Text.RegularExpressions.Tests VerifyMatches(Regex.Match(input, pattern, options), expected); } - public static void VerifyMatches(Match match, CaptureData[] expected) + private static void VerifyMatches(Match match, CaptureData[] expected) { for (int i = 0; match.Success; i++, match = match.NextMatch()) { @@ -172,7 +172,7 @@ namespace System.Text.RegularExpressions.Tests } } - public static void VerifyMatches(MatchCollection matches, CaptureData[] expected) + private static void VerifyMatches(MatchCollection matches, CaptureData[] expected) { Assert.Equal(expected.Length, matches.Count); for (int i = 0; i < matches.Count; i++) @@ -181,7 +181,7 @@ namespace System.Text.RegularExpressions.Tests } } - public static void VerifyMatch(Match match, CaptureData expected) + private static void VerifyMatch(Match match, CaptureData expected) { Assert.True(match.Success); Assert.Equal(expected.Value, match.Value); diff --git a/src/libraries/System.Threading.Tasks/tests/CESchedulerPairTests.cs b/src/libraries/System.Threading.Tasks/tests/CESchedulerPairTests.cs index d4145db9e04..dee6b0af088 100644 --- a/src/libraries/System.Threading.Tasks/tests/CESchedulerPairTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/CESchedulerPairTests.cs @@ -555,7 +555,7 @@ namespace System.Threading.Tasks.Tests #region Helper Methods - public static void SelectAPI2Target(string apiType, int taskCount, TaskScheduler scheduler, Action work) + private static void SelectAPI2Target(string apiType, int taskCount, TaskScheduler scheduler, Action work) { switch (apiType) { diff --git a/src/libraries/System.Threading.Tasks/tests/CancellationTokenTests.cs b/src/libraries/System.Threading.Tasks/tests/CancellationTokenTests.cs index 9a1f61efeb2..2a44a194314 100644 --- a/src/libraries/System.Threading.Tasks/tests/CancellationTokenTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/CancellationTokenTests.cs @@ -1369,7 +1369,7 @@ namespace System.Threading.Tasks.Tests public bool DisposeFalseCalled = false; } - public static void SetSynchronizationContext(SynchronizationContext sc) + private static void SetSynchronizationContext(SynchronizationContext sc) { SynchronizationContext.SetSynchronizationContext(sc); } diff --git a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWhenAnyTests.cs b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWhenAnyTests.cs index 7085676ad78..baff74b0acb 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWhenAnyTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWhenAnyTests.cs @@ -215,7 +215,7 @@ namespace System.Threading.Tasks.Tests } // end i-loop (antecedentsAreFutures) } - public static void TestContinueWhenAnyException(Task[] antecedents, bool FutureFactory, bool continuationIsFuture) + private static void TestContinueWhenAnyException(Task[] antecedents, bool FutureFactory, bool continuationIsFuture) { bool antecedentsAreFutures = (antecedents as Task[]) != null; @@ -477,7 +477,7 @@ namespace System.Threading.Tasks.Tests #region Helper Methods // used in ContinueWhenAll/ContinueWhenAny tests - public static void startTaskArray(Task[] tasks) + private static void startTaskArray(Task[] tasks) { for (int i = 0; i < tasks.Length; i++) { @@ -486,7 +486,7 @@ namespace System.Threading.Tasks.Tests } } - public static void CheckForCorrectCT(Task canceledTask, CancellationToken correctToken) + private static void CheckForCorrectCT(Task canceledTask, CancellationToken correctToken) { try { diff --git a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWithTests.cs b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWithTests.cs index e29b1ea8b47..ebe7a1f373b 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWithTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWithTests.cs @@ -1295,7 +1295,7 @@ namespace System.Threading.Tasks.Tests #region Helper Methods - public static void ContinueWithTortureTest(int numCanceled, int numLeftover, int completeAfter, int cancelAfter) + private static void ContinueWithTortureTest(int numCanceled, int numLeftover, int completeAfter, int cancelAfter) { //Debug.WriteLine(" - ContinueWithTortureTest(numCanceled={0}, numLeftover={1}, completeAfter={2}, cancelAfter={3})", // numCanceled, numLeftover, completeAfter, cancelAfter); @@ -1378,7 +1378,7 @@ namespace System.Threading.Tasks.Tests } // Ensures that the specified action throws a AggregateException wrapping a TaskCanceledException - public static void EnsureTaskCanceledExceptionThrown(Action action, string message) + private static void EnsureTaskCanceledExceptionThrown(Action action, string message) { Exception exception = null; @@ -1395,7 +1395,7 @@ namespace System.Threading.Tasks.Tests } // Ensures that the specified exception is an AggregateException wrapping a TaskCanceledException - public static void EnsureExceptionIsAEofTCE(Exception exception, string message) + private static void EnsureExceptionIsAEofTCE(Exception exception, string message) { if (exception == null) { diff --git a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionTests.cs b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionTests.cs index 1fa83d692d5..6988f6b63a2 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionTests.cs @@ -187,7 +187,7 @@ namespace System.Threading.Tasks.Tests #region Helper Methods // Chains a Task continuation to a Task. - public static void RunContinueWithTaskTask(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithTaskTask(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; if (runNegativeCases) @@ -217,7 +217,7 @@ namespace System.Threading.Tasks.Tests } // Chains a Task continuation to a Task, with a Func. - public static void RunContinueWithTaskFuture(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithTaskFuture(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; if (runNegativeCases) @@ -247,7 +247,7 @@ namespace System.Threading.Tasks.Tests } // Chains a Task continuation to a Task. - public static void RunContinueWithFutureTask(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithFutureTask(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; if (runNegativeCases) @@ -277,7 +277,7 @@ namespace System.Threading.Tasks.Tests } // Chains a Task continuation to a Task, with a Func, U>. - public static void RunContinueWithFutureFuture(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithFutureFuture(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; if (runNegativeCases) @@ -307,7 +307,7 @@ namespace System.Threading.Tasks.Tests } // Base logic for RunContinueWithXXXYYY() methods - public static void RunContinueWithBase( + private static void RunContinueWithBase( TaskContinuationOptions options, Action initRan, Func continuationMaker, @@ -360,7 +360,7 @@ namespace System.Threading.Tasks.Tests } // Base logic for RunContinueWithXXXYYY() methods - public static void RunContinueWithBase_NegativeCases( + private static void RunContinueWithBase_NegativeCases( TaskContinuationOptions options, Action initRan, Func continuationMaker, diff --git a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionWithArgsTests.cs b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionWithArgsTests.cs index 14895afd173..7c6b844bfec 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionWithArgsTests.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/TaskContinueWith_ContFuncAndActionWithArgsTests.cs @@ -414,7 +414,7 @@ namespace System.Threading.Tasks.Tests #region Helper Methods // Chains a Task continuation to a Task. - public static void RunContinueWithTaskTask_State(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithTaskTask_State(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; @@ -447,7 +447,7 @@ namespace System.Threading.Tasks.Tests } // Chains a Task continuation to a Task, with a Func. - public static void RunContinueWithTaskFuture_State(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithTaskFuture_State(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; @@ -481,7 +481,7 @@ namespace System.Threading.Tasks.Tests } // Chains a Task continuation to a Task. - public static void RunContinueWithFutureTask_State(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithFutureTask_State(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; @@ -515,7 +515,7 @@ namespace System.Threading.Tasks.Tests } // Chains a Task continuation to a Task, with a Func, U>. - public static void RunContinueWithFutureFuture_State(TaskContinuationOptions options, bool runNegativeCases = false) + private static void RunContinueWithFutureFuture_State(TaskContinuationOptions options, bool runNegativeCases = false) { bool ran = false; @@ -548,7 +548,7 @@ namespace System.Threading.Tasks.Tests } // Base logic for RunContinueWithXXXYYY() methods - public static void RunContinueWithBase( + private static void RunContinueWithBase( TaskContinuationOptions options, Action initRan, Func continuationMaker, @@ -601,7 +601,7 @@ namespace System.Threading.Tasks.Tests } // Base logic for RunContinueWithXXXYYY() methods - public static void RunContinueWithBase_ExceptionCases( + private static void RunContinueWithBase_ExceptionCases( TaskContinuationOptions options, Action initRan, Func continuationMaker, @@ -708,7 +708,7 @@ namespace System.Threading.Tasks.Tests } // Ensures that the specified exception is an AggregateException wrapping a TaskCanceledException - public static void EnsureExceptionIsAEofTCE(Exception exception, string message) + private static void EnsureExceptionIsAEofTCE(Exception exception, string message) { if (exception == null) { diff --git a/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests_Core.cs b/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests_Core.cs index c3bd6fbf801..8d4ddec8467 100644 --- a/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests_Core.cs +++ b/src/libraries/System.Threading.Tasks/tests/Task/TaskRtTests_Core.cs @@ -1167,7 +1167,7 @@ namespace System.Threading.Tasks.Tests () => Task.WaitAny(new Task[] { Task.Factory.StartNew(() => { }) }, TimeSpan.FromMilliseconds(-2))); } - public static void CoreWaitAnyTest(int fillerTasks, bool[] finishMeFirst, int nExpectedReturnCode) + private static void CoreWaitAnyTest(int fillerTasks, bool[] finishMeFirst, int nExpectedReturnCode) { // We need to do this test in a local TM with # or threads equal to or greater than // the number of tasks requested. Otherwise this test can undeservedly fail on dual proc machines @@ -1331,7 +1331,7 @@ namespace System.Threading.Tasks.Tests RunTaskWaitAllTest(false, 10); } - public static void RunTaskWaitAllTest(bool staThread, int nTaskCount) + private static void RunTaskWaitAllTest(bool staThread, int nTaskCount) { string methodInput = string.Format("RunTaskWaitAllTest: > WaitAll() Tests for aptState={0}, task count={1}", staThread ? "MTA" : "STA", nTaskCount); string excpMsg = "foo"; @@ -1431,7 +1431,7 @@ namespace System.Threading.Tasks.Tests // the core function for WaitAll tests. Takes 2 types of actions to create tasks, how many copies of each task type // to create, whether to wait for the completion of the first group, etc // - public static void DoRunTaskWaitAllTest(bool staThread, + private static void DoRunTaskWaitAllTest(bool staThread, int numTasksType1, Action taskAction1, bool bWaitOnAct1, @@ -1495,7 +1495,7 @@ namespace System.Threading.Tasks.Tests // the core function for WaitAll tests. Takes 2 types of actions to create tasks, how many copies of each task type // to create, whether to wait for the completion of the first group, etc // - public static void DoRunTaskWaitAllTestWithCancellationToken(bool staThread, + private static void DoRunTaskWaitAllTestWithCancellationToken(bool staThread, int numTasks, bool bWaitOnAct1, bool bCancelAct1, diff --git a/src/libraries/System.Threading.Thread/tests/ThreadTests.cs b/src/libraries/System.Threading.Thread/tests/ThreadTests.cs index 6e35f06ef1c..b7602188529 100644 --- a/src/libraries/System.Threading.Thread/tests/ThreadTests.cs +++ b/src/libraries/System.Threading.Thread/tests/ThreadTests.cs @@ -207,7 +207,7 @@ namespace System.Threading.Threads.Tests } // Thread is always initialized as MTA irrespective of the attribute present. - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsWindowsNanoServer))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsWindowsNanoServer))] public static void ApartmentState_NoAttributePresent_DefaultState_Nano() { RemoteExecutor.Invoke(() => diff --git a/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs b/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs index bb36ceffdb2..e06b4f5ae00 100644 --- a/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs +++ b/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs @@ -1643,7 +1643,7 @@ namespace System.Transactions.Tests Task.WaitAll(a); } - public static void VerifyTxId(bool requiresNew, string parentTxId, string beforeTxId, string afterTxId) + private static void VerifyTxId(bool requiresNew, string parentTxId, string beforeTxId, string afterTxId) { Assert.Equal(beforeTxId, afterTxId); if (requiresNew) @@ -1659,7 +1659,7 @@ namespace System.Transactions.Tests } } - public static void AssertTransaction(string txId) + private static void AssertTransaction(string txId) { if (string.IsNullOrEmpty(txId)) { @@ -1670,23 +1670,23 @@ namespace System.Transactions.Tests Assert.Equal(txId, AssertAndGetCurrentTransactionId()); } } - public static void AssertTransactionNull() + private static void AssertTransactionNull() { Assert.Equal(null, Transaction.Current); } - public static void AssertTransactionNotNull() + private static void AssertTransactionNotNull() { Assert.NotEqual(null, Transaction.Current); } - public static string AssertAndGetCurrentTransactionId() + private static string AssertAndGetCurrentTransactionId() { AssertTransactionNotNull(); return Transaction.Current.TransactionInformation.LocalIdentifier; } - public static string AssertAndGetCurrentTransactionId(TransactionScopeOption scopeOption) + private static string AssertAndGetCurrentTransactionId(TransactionScopeOption scopeOption) { if (scopeOption == TransactionScopeOption.Suppress) { @@ -1700,33 +1700,33 @@ namespace System.Transactions.Tests } } - public static void AssertTransactionNullAndWaitTask(Task task) + private static void AssertTransactionNullAndWaitTask(Task task) { AssertTransactionNull(); task.Wait(); AssertTransactionNull(); } - public static void AssertTransactionNullAndWaitTask(Task task) + private static void AssertTransactionNullAndWaitTask(Task task) { AssertTransactionNull(); task.Wait(); AssertTransactionNull(); } - public static void SetExceptionInjection(bool exceptionDefaultOrBeforeAwait, bool exceptionAfterAwait) + private static void SetExceptionInjection(bool exceptionDefaultOrBeforeAwait, bool exceptionAfterAwait) { s_throwExceptionDefaultOrBeforeAwait = exceptionDefaultOrBeforeAwait; s_throwExceptionAfterAwait = exceptionAfterAwait; } - public static void ResetExceptionInjection() + private static void ResetExceptionInjection() { s_throwExceptionDefaultOrBeforeAwait = false; s_throwExceptionAfterAwait = false; } - public static void HandleException(bool exceptionDefaultOrBeforeAwait, bool exceptionAfterAwait, Action action) + private static void HandleException(bool exceptionDefaultOrBeforeAwait, bool exceptionAfterAwait, Action action) { bool hasException = false; diff --git a/src/libraries/System.Transactions.Local/tests/NonMsdtcPromoterTests.cs b/src/libraries/System.Transactions.Local/tests/NonMsdtcPromoterTests.cs index b78ef4a3046..7b1d3b92ead 100644 --- a/src/libraries/System.Transactions.Local/tests/NonMsdtcPromoterTests.cs +++ b/src/libraries/System.Transactions.Local/tests/NonMsdtcPromoterTests.cs @@ -78,7 +78,7 @@ namespace System.Transactions.Tests cloneToComplete.Complete(); } - public static void Promote(string testCaseDescription, byte[] promotedTokenToCompare, Transaction txToPromote = null) + private static void Promote(string testCaseDescription, byte[] promotedTokenToCompare, Transaction txToPromote = null) { if (txToPromote == null) { @@ -100,7 +100,7 @@ namespace System.Transactions.Tests Assert.True(PromotedTokensMatch(promotedToken, NonMsdtcPromoterTests.PromotedToken1)); } - public static void Trace(string stringToTrace) + private static void Trace(string stringToTrace) { if (s_traceEnabled) { @@ -108,7 +108,7 @@ namespace System.Transactions.Tests } } - public static void NoStressTrace(string stringToTrace) + private static void NoStressTrace(string stringToTrace) { //if (NonMsdtcPromoterTests.loopCount == 1) { @@ -1258,7 +1258,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_AbortFromVolatile(bool promote, EnlistmentOptions enlistmentOptions = EnlistmentOptions.None) + private static void TestCase_AbortFromVolatile(bool promote, EnlistmentOptions enlistmentOptions = EnlistmentOptions.None) { string testCaseDescription = string.Format( "TestCase_AbortFromVolatile promote={0}; enlistmentOptions = {1}", @@ -1315,7 +1315,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_AbortingCloneNotCompleted(bool promote) + private static void TestCase_AbortingCloneNotCompleted(bool promote) { string testCaseDescription = string.Format( "TestCase_AbortingCloneNotCompleted promote={0}", @@ -1370,7 +1370,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_BlockingCloneCompletedAfterCommit(bool promote) + private static void TestCase_BlockingCloneCompletedAfterCommit(bool promote) { string testCaseDescription = string.Format( "TestCase_BlockingCloneCompletedAfterCommit promote={0}", @@ -1430,7 +1430,7 @@ namespace System.Transactions.Tests TestPassed(true); } - public static void TestCase_TransactionTimeout(bool promote) + private static void TestCase_TransactionTimeout(bool promote) { string testCaseDescription = string.Format( "TestCase_TransactionTimeout promote={0}", @@ -1485,7 +1485,7 @@ namespace System.Transactions.Tests TestPassed(true); } - public static void TestCase_EnlistDuringPrepare(bool promote, + private static void TestCase_EnlistDuringPrepare(bool promote, bool beforePromote, EnlistmentOptions firstOptions = EnlistmentOptions.None, EnlistmentOptions secondOptions = EnlistmentOptions.None, @@ -1585,7 +1585,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_GetStatusAndDistributedId() + private static void TestCase_GetStatusAndDistributedId() { string testCaseDescription = "TestCase_GetDistributedId"; @@ -1637,7 +1637,7 @@ namespace System.Transactions.Tests } } - public static void TestCase_DisposeCommittableTransaction(bool promote) + private static void TestCase_DisposeCommittableTransaction(bool promote) { string testCaseDescription = string.Format( "TestCase_DisposeCommittableTransaction promote={0}", @@ -1696,7 +1696,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_OutcomeRegistration(bool promote) + private static void TestCase_OutcomeRegistration(bool promote) { string testCaseDescription = string.Format( "TestCase_OutcomeRegistration promote={0}", @@ -1779,7 +1779,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_PromoterType() + private static void TestCase_PromoterType() { string testCaseDescription = "TestCase_PromoterType"; @@ -1824,7 +1824,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_PromoterTypeMSDTC() + private static void TestCase_PromoterTypeMSDTC() { string testCaseDescription = "TestCase_PromoterTypeMSDTC"; @@ -1863,7 +1863,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_FailPromotableSinglePhaseNotificationCalls() + private static void TestCase_FailPromotableSinglePhaseNotificationCalls() { string testCaseDescription = "TestCase_FailPromotableSinglePhaseNotificationCalls"; @@ -1973,7 +1973,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_SetDistributedIdAtWrongTime() + private static void TestCase_SetDistributedIdAtWrongTime() { string testCaseDescription = "TestCase_SetDistributedIdAtWrongTime"; @@ -2028,7 +2028,7 @@ namespace System.Transactions.Tests TestPassed(); } - public static void TestCase_SetDistributedIdWithWrongNotificationObject() + private static void TestCase_SetDistributedIdWithWrongNotificationObject() { string testCaseDescription = "TestCase_SetDistributedIdWithWrongNotificationObject"; diff --git a/src/libraries/System.ValueTuple/tests/System.ValueTuple.Tests.csproj b/src/libraries/System.ValueTuple/tests/System.ValueTuple.Tests.csproj index 56b70dbccd2..19fee1b8d0a 100644 --- a/src/libraries/System.ValueTuple/tests/System.ValueTuple.Tests.csproj +++ b/src/libraries/System.ValueTuple/tests/System.ValueTuple.Tests.csproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/src/libraries/System.ValueTuple/tests/TupleTests.cs b/src/libraries/System.ValueTuple/tests/TupleTests.cs index a180529fc2f..626f40c64a7 100644 --- a/src/libraries/System.ValueTuple/tests/TupleTests.cs +++ b/src/libraries/System.ValueTuple/tests/TupleTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if netcoreapp using System; using System.Collections; using System.Collections.Generic; @@ -14,20 +13,7 @@ namespace System.Tests public class TupleTests { [Fact] - public void Test() - { - // Subset of the Tuple tests related to ITuple - OneTuples(); - TwoTuples(); - ThreeTuples(); - FourTuples(); - FiveTuples(); - SixTuples(); - SevenTuples(); - EightTuples(); - } - - public static void OneTuples() + private static void OneTuples() { ITuple it = Tuple.Create(1); Assert.Throws(() => it[-1].ToString()); @@ -35,7 +21,8 @@ namespace System.Tests Assert.Throws(() => it[1].ToString()); } - public static void TwoTuples() + [Fact] + private static void TwoTuples() { ITuple it = Tuple.Create(1, 2); Assert.Throws(() => it[-1].ToString()); @@ -44,7 +31,8 @@ namespace System.Tests Assert.Throws(() => it[2].ToString()); } - public static void ThreeTuples() + [Fact] + private static void ThreeTuples() { ITuple it = Tuple.Create(1, 2, 3); Assert.Throws(() => it[-1].ToString()); @@ -54,7 +42,8 @@ namespace System.Tests Assert.Throws(() => it[3].ToString()); } - public static void FourTuples() + [Fact] + private static void FourTuples() { ITuple it = Tuple.Create(1, 2, 3, 4); Assert.Throws(() => it[-1].ToString()); @@ -64,8 +53,9 @@ namespace System.Tests Assert.Equal(4, it[3]); Assert.Throws(() => it[4].ToString()); } + [Fact] - public static void FiveTuples() + private static void FiveTuples() { ITuple it = Tuple.Create(1, 2, 3, 4, 5); Assert.Throws(() => it[-1].ToString()); @@ -77,7 +67,8 @@ namespace System.Tests Assert.Throws(() => it[5].ToString()); } - public static void SixTuples() + [Fact] + private static void SixTuples() { ITuple it = Tuple.Create(1, 2, 3, 4, 5, 6); Assert.Throws(() => it[-1].ToString()); @@ -90,7 +81,8 @@ namespace System.Tests Assert.Throws(() => it[6].ToString()); } - public static void SevenTuples() + [Fact] + private static void SevenTuples() { ITuple it = Tuple.Create(1, 2, 3, 4, 5, 6, 7); Assert.Throws(() => it[-1].ToString()); @@ -104,12 +96,13 @@ namespace System.Tests Assert.Throws(() => it[7].ToString()); } - public static Tuple CreateLongRef(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) + private static Tuple CreateLongRef(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { return new Tuple(item1, item2, item3, item4, item5, item6, item7, rest); } - public static void EightTuples() + [Fact] + private static void EightTuples() { ITuple it = CreateLongRef(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8)); Assert.Throws(() => it[-1].ToString()); @@ -125,4 +118,3 @@ namespace System.Tests } } } -#endif diff --git a/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs b/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs index 6cd4fe059d9..9ccb85644ee 100644 --- a/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs +++ b/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs @@ -228,7 +228,7 @@ namespace System.Media.Test soundPlayer.Load(); } - [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))] public void Play_NoSuchFile_ThrowsFileNotFoundException() { var soundPlayer = new SoundPlayer("noSuchFile");