From 13fc8895dbf548a79695a6306b2c98ceb81916fb Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sun, 28 Jul 2019 22:34:44 -0400 Subject: [PATCH] Re-enable xunit warning 1010 (dotnet/corefx#39846) Commit migrated from https://github.com/dotnet/corefx/commit/e36291288fc182e94a919f45e61a8924f953c3cd --- src/libraries/CodeAnalysis.ruleset | 1 - .../tests/FinancialTests.cs | 28 +++++++++++----------- .../tests/StringsTests.cs | 20 ++++++++-------- .../System.Drawing.Common/tests/FontTests.cs | 2 +- .../tests/Printing/PaperSizeTests.cs | 4 ++-- .../tests/ColorTests.netcoreapp.cs | 16 ++++++------- .../tests/Args.FileSystemEventArgs.cs | 6 ++--- .../tests/Args.RenamedEventArgs.cs | 10 ++++---- .../tests/DirectoryInfo/GetSetAttributes.cs | 4 ++-- .../AnonymousPipeTest.CreateServer.cs | 4 ++-- .../tests/HttpListenerRequestTests.cs | 19 --------------- .../System.Reflection/tests/ModuleTests.cs | 3 ++- .../Reflection/AssemblyFlagsAttributeTests.cs | 2 +- .../tests/Asn1/Reader/ReadNamedBitList.cs | 24 +++++++++---------- .../tests/Asn1/Writer/WriteInteger.cs | 2 +- .../Syndication/SyndicationFeedTests.netcoreapp.cs | 4 ++-- .../System.Text.Json/tests/JsonDocumentTests.cs | 2 +- .../tests/Serialization/OptionsTests.cs | 2 +- .../tests/System/Char8Tests.cs | 10 ++++---- .../tests/HttpUtility/HttpUtilityTest.cs | 4 ++-- 20 files changed, 74 insertions(+), 93 deletions(-) diff --git a/src/libraries/CodeAnalysis.ruleset b/src/libraries/CodeAnalysis.ruleset index f455904..df3027e 100644 --- a/src/libraries/CodeAnalysis.ruleset +++ b/src/libraries/CodeAnalysis.ruleset @@ -75,7 +75,6 @@ - diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/FinancialTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/FinancialTests.cs index 6a9164d..9622a72 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/FinancialTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/FinancialTests.cs @@ -55,8 +55,8 @@ namespace Microsoft.VisualBasic.Tests [InlineData(0.01, 37, 100.0, 0, DueDate.BegOfPeriod, -4495.27236141772, -4495.2723614177185)] [InlineData(-0.0083, 15, 263.0, 0, DueDate.EndOfPeriod, -3723.83765008048, -3723.837650080481)] // rate < 0 [InlineData(0, 15, 263, 0, DueDate.EndOfPeriod, -3945, -3945)] // rate = 0 - [InlineData(0.0083, 15, 263.0, 0, 8, -4217.37334665461, -4217.37334665461)] // type <> 0 and type <> 1 - [InlineData(1e+25, 12, 1797, 0, 1, -1.797e+303, -1.797000000000002e+303)] // overFlow + [InlineData(0.0083, 15, 263.0, 0, (DueDate)8, -4217.37334665461, -4217.37334665461)] // type <> 0 and type <> 1 + [InlineData(1e+25, 12, 1797, 0, (DueDate)1, -1.797e+303, -1.797000000000002e+303)] // overFlow public void FV(double Rate, double NPer, double Pmt, double PV, DueDate Due, double expectedOld, double expectedNew) { AreEqual(expectedOld, expectedNew, Financial.FV(Rate, NPer, Pmt, PV, Due)); @@ -72,12 +72,12 @@ namespace Microsoft.VisualBasic.Tests [ConditionalTheory(nameof(IsNotArmOrAlpine))] // some tests fail due to precision [InlineData(0, 1.0, 1.0, 0, 0, DueDate.EndOfPeriod, 0, 0)] [InlineData(0.1 / 12, 12.0, 48.0, -20000.0, 0, DueDate.BegOfPeriod, 133.00409235109, 133.00409235108953)] - [InlineData(0.008, 4, 12, 3000, 0, 0, -18.2133959841799, -18.21339598417987)] - [InlineData(0.012, 15, 79, 2387, 200, 1, -24.7440714828291, -24.74407148282907)] - [InlineData(0.0096, 54, 123, 4760, 0, 0, -32.2391587542905, -32.23915875429054)] - [InlineData(-0.008, 4, 12, 3000, 0, 0, 17.7814213334481, 17.781421333448126)] // rate < 0 - [InlineData(0, 4, 12, 3000, 0, 0, 0, 0)] // rate = 0 - [InlineData(0.008, 4, 12, 3000, 0, 7, -18.0688452224006, -18.068845222400633)] // type <> 0 and type <> 1 + [InlineData(0.008, 4, 12, 3000, 0, (DueDate)0, -18.2133959841799, -18.21339598417987)] + [InlineData(0.012, 15, 79, 2387, 200, (DueDate)1, -24.7440714828291, -24.74407148282907)] + [InlineData(0.0096, 54, 123, 4760, 0, (DueDate)0, -32.2391587542905, -32.23915875429054)] + [InlineData(-0.008, 4, 12, 3000, 0, (DueDate)0, 17.7814213334481, 17.781421333448126)] // rate < 0 + [InlineData(0, 4, 12, 3000, 0, (DueDate)0, 0, 0)] // rate = 0 + [InlineData(0.008, 4, 12, 3000, 0, (DueDate)7, -18.0688452224006, -18.068845222400633)] // type <> 0 and type <> 1 public void IPmt(double Rate, double Per, double NPer, double PV, double FV, DueDate Due, double expectedOld, double expectedNew) { AreEqual(expectedOld, expectedNew, Financial.IPmt(Rate, Per, NPer, PV, FV, Due)); @@ -93,9 +93,9 @@ namespace Microsoft.VisualBasic.Tests } [Theory] - [InlineData(0.008, -4, 12, 3000, 0, 0)] - [InlineData(0.008, 4, -12, 3000, 0, 0)] - [InlineData(0.008, 12, 4, 3000, 0, 0)] + [InlineData(0.008, -4, 12, 3000, 0, (DueDate)0)] + [InlineData(0.008, 4, -12, 3000, 0, (DueDate)0)] + [InlineData(0.008, 12, 4, 3000, 0, (DueDate)0)] public void IPmt_Invalid(double Rate, double Per, double NPer, double PV, double FV, DueDate Due) { Assert.Throws(() => Financial.IPmt(Rate, Per, NPer, PV, FV, Due)); @@ -150,7 +150,7 @@ namespace Microsoft.VisualBasic.Tests [InlineData(0.0096, 1500.0, -70000.0, 10000, DueDate.EndOfPeriod, 55.2706372559078, 55.2706372559078)] [InlineData(-0.0072, -350.0, 7000.0, 0, DueDate.EndOfPeriod, 18.6174997871788, 18.617499787178836)] // rate < 0 [InlineData(0, -350.0, 7000.0, 0, DueDate.EndOfPeriod, 20, 20)] // rate = 0 - [InlineData(0.0072, -350.0, 7000.0, 0, 7, 21.5052532943763, 21.505253294376303)] // type <> 0 and type <> 1 + [InlineData(0.0072, -350.0, 7000.0, 0, (DueDate)7, 21.5052532943763, 21.505253294376303)] // type <> 0 and type <> 1 [InlineData(0.0072, -9000.0, 200.0, 0, DueDate.EndOfPeriod, 0.0223039109268324, 0.02230391092683241)] // pmt > pv public void NPer(double Rate, double Pmt, double PV, double FV, DueDate Due, double expectedOld, double expectedNew) { @@ -194,7 +194,7 @@ namespace Microsoft.VisualBasic.Tests [InlineData(0.0012, 5, 500, 0, DueDate.EndOfPeriod, -100.360287827152, -100.36028782715209)] [InlineData(-0.007, 25, -3000, 0, DueDate.EndOfPeriod, 109.386677326841, 109.38667732684138)] // rate < 0 [InlineData(0.007, -25, 3000, 0, DueDate.EndOfPeriod, 110.224540233228, 110.22454023322811)] // nper < 0 - [InlineData(0.007, 25, 3000, 0, 7, -130.31235375693, -130.31235375692967)] // type <> 0 and type <> 1 + [InlineData(0.007, 25, 3000, 0, (DueDate)7, -130.31235375693, -130.31235375692967)] // type <> 0 and type <> 1 [InlineData(0, 25, 3000, 0, DueDate.EndOfPeriod, -120, -120)] // rate = 0 public void Pmt(double Rate, double NPer, double PV, double FV, DueDate Due, double expectedOld, double expectedNew) { @@ -215,7 +215,7 @@ namespace Microsoft.VisualBasic.Tests [InlineData(0.012, 15, 79, 2387, 200, DueDate.BegOfPeriod, -23.1486833595771, -23.14868335957714)] [InlineData(0.0096, 54, 123, 4760, 0, DueDate.EndOfPeriod, -33.8688007923638, -33.86880079236377)] [InlineData(-0.008, 4, 12, 3000, 0, DueDate.EndOfPeriod, -254.972824918514, -254.97282491851354)] // rate < 0 - [InlineData(0.008, 4, 12, 3000, 0, 7, -243.03222512529, -243.03222512529004)] // type <> 0 and type <> 1 + [InlineData(0.008, 4, 12, 3000, 0, (DueDate)7, -243.03222512529, -243.03222512529004)] // type <> 0 and type <> 1 public void PPmt(double Rate, double Per, double NPer, double PV, double FV, DueDate Due, double expectedOld, double expectedNew) { AreEqual(expectedOld, expectedNew, Financial.PPmt(Rate, Per, NPer, PV, FV, Due)); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs index 9606845..db731bb 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs @@ -556,11 +556,11 @@ namespace Microsoft.VisualBasic.Tests } [Theory] - [InlineData('\0', "\0")] - [InlineData('\uffff', "\uffff")] - [InlineData('a', "a")] - [InlineData('A', "a")] - [InlineData('1', "1")] + [InlineData('\0', '\0')] + [InlineData('\uffff', '\uffff')] + [InlineData('a', 'a')] + [InlineData('A', 'a')] + [InlineData('1', '1')] public void LCase(char value, char expected) { Assert.Equal(expected, Strings.LCase(value)); @@ -580,11 +580,11 @@ namespace Microsoft.VisualBasic.Tests } [Theory] - [InlineData('\0', "\0")] - [InlineData('\uffff', "\uffff")] - [InlineData('a', "A")] - [InlineData('A', "A")] - [InlineData('1', "1")] + [InlineData('\0', '\0')] + [InlineData('\uffff', '\uffff')] + [InlineData('a', 'A')] + [InlineData('A', 'A')] + [InlineData('1', '1')] public void UCase(char value, char expected) { Assert.Equal(expected, Strings.UCase(value)); diff --git a/src/libraries/System.Drawing.Common/tests/FontTests.cs b/src/libraries/System.Drawing.Common/tests/FontTests.cs index 6211d93..75289f8 100644 --- a/src/libraries/System.Drawing.Common/tests/FontTests.cs +++ b/src/libraries/System.Drawing.Common/tests/FontTests.cs @@ -737,7 +737,7 @@ namespace System.Drawing.Tests [ActiveIssue(20884, TestPlatforms.AnyUnix)] [ConditionalTheory(Helpers.IsDrawingSupported)] - [InlineData(FontStyle.Strikeout | FontStyle.Bold | FontStyle.Italic, true, 255, "@", 700)] + [InlineData(FontStyle.Strikeout | FontStyle.Bold | FontStyle.Italic, 255, true, "@", 700)] [InlineData(FontStyle.Regular, 0, false, "", 400)] [InlineData(FontStyle.Regular, 10, false, "", 400)] public void ToLogFont_Invoke_ReturnsExpected(FontStyle fontStyle, byte gdiCharSet, bool gdiVerticalFont, string expectedNamePrefix, int expectedWeight) diff --git a/src/libraries/System.Drawing.Common/tests/Printing/PaperSizeTests.cs b/src/libraries/System.Drawing.Common/tests/Printing/PaperSizeTests.cs index df2892f..f8f8d4d 100644 --- a/src/libraries/System.Drawing.Common/tests/Printing/PaperSizeTests.cs +++ b/src/libraries/System.Drawing.Common/tests/Printing/PaperSizeTests.cs @@ -98,11 +98,11 @@ namespace System.Drawing.Printing.Tests [InlineData(999999, PaperKind.Custom)] [InlineData(int.MaxValue, PaperKind.Custom)] [InlineData(1 + (int)PaperKind.PrcEnvelopeNumber10Rotated, PaperKind.Custom)] - public void RawKind_ReturnsExpected(int rawKind, int expectedKind) + public void RawKind_ReturnsExpected(int rawKind, PaperKind expectedKind) { PaperSize ps = new PaperSize(); ps.RawKind = rawKind; - Assert.Equal((PaperKind)expectedKind, ps.Kind); + Assert.Equal(expectedKind, ps.Kind); Assert.Equal(rawKind, ps.RawKind); } diff --git a/src/libraries/System.Drawing.Primitives/tests/ColorTests.netcoreapp.cs b/src/libraries/System.Drawing.Primitives/tests/ColorTests.netcoreapp.cs index 06c9007..bc40870 100644 --- a/src/libraries/System.Drawing.Primitives/tests/ColorTests.netcoreapp.cs +++ b/src/libraries/System.Drawing.Primitives/tests/ColorTests.netcoreapp.cs @@ -78,8 +78,8 @@ namespace System.Drawing.Primitives.Tests } [Theory] - [InlineData(-1)] - [InlineData(0)] + [InlineData((KnownColor)(-1))] + [InlineData((KnownColor)0)] [InlineData(KnownColor.MenuHighlight + 1)] public void FromOutOfRangeKnownColor(KnownColor known) { @@ -102,8 +102,8 @@ namespace System.Drawing.Primitives.Tests } [Theory] - [InlineData(-1)] - [InlineData(0)] + [InlineData((KnownColor)(-1))] + [InlineData((KnownColor)0)] [InlineData(KnownColor.MenuHighlight + 1)] public void FromOutOfRangeKnownColorToKnownColor(KnownColor known) { @@ -134,8 +134,8 @@ namespace System.Drawing.Primitives.Tests } [Theory] - [InlineData(-1)] - [InlineData(0)] + [InlineData((KnownColor)(-1))] + [InlineData((KnownColor)0)] [InlineData(KnownColor.MenuHighlight + 1)] public void IsSystemColorOutOfRangeKnown(KnownColor known) { @@ -158,8 +158,8 @@ namespace System.Drawing.Primitives.Tests } [Theory] - [InlineData(-1)] - [InlineData(0)] + [InlineData((KnownColor)(-1))] + [InlineData((KnownColor)0)] [InlineData(KnownColor.MenuHighlight + 1)] public void IsKnownColorOutOfRangeKnown(KnownColor known) { diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs index 9ab5264..5931919 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs @@ -11,8 +11,8 @@ namespace System.IO.Tests [Theory] [InlineData(WatcherChangeTypes.Changed, "C:", "foo.txt")] [InlineData(WatcherChangeTypes.All, "C:", "foo.txt")] - [InlineData(0, "", "")] - [InlineData(0, "", null)] + [InlineData((WatcherChangeTypes)0, "", "")] + [InlineData((WatcherChangeTypes)0, "", null)] public static void FileSystemEventArgs_ctor(WatcherChangeTypes changeType, string directory, string name) { FileSystemEventArgs args = new FileSystemEventArgs(changeType, directory, name); @@ -33,4 +33,4 @@ namespace System.IO.Tests Assert.Throws(() => new FileSystemEventArgs((WatcherChangeTypes)0, null, string.Empty)); } } -} \ No newline at end of file +} diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs index a4e5737..1413501 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs @@ -11,8 +11,8 @@ namespace System.IO.Tests [Theory] [InlineData(WatcherChangeTypes.Changed, "C:", "foo.txt", "bar.txt")] [InlineData(WatcherChangeTypes.All, "C:", "foo.txt", "bar.txt")] - [InlineData(0, "", "", "")] - [InlineData(0, "", null, null)] + [InlineData((WatcherChangeTypes)0, "", "", "")] + [InlineData((WatcherChangeTypes)0, "", null, null)] public static void RenamedEventArgs_ctor(WatcherChangeTypes changeType, string directory, string name, string oldName) { RenamedEventArgs args = new RenamedEventArgs(changeType, directory, name, oldName); @@ -25,8 +25,8 @@ namespace System.IO.Tests [Theory] [InlineData(WatcherChangeTypes.Changed, "C:", "foo.txt", "bar.txt")] [InlineData(WatcherChangeTypes.All, "C:", "foo.txt", "bar.txt")] - [InlineData(0, "", "", "")] - [InlineData(0, "", null, null)] + [InlineData((WatcherChangeTypes)0, "", "", "")] + [InlineData((WatcherChangeTypes)0, "", null, null)] public static void RenamedEventArgs_ctor_OldFullPath(WatcherChangeTypes changeType, string directory, string name, string oldName) { RenamedEventArgs args = new RenamedEventArgs(changeType, directory, name, oldName); @@ -39,4 +39,4 @@ namespace System.IO.Tests Assert.Throws(() => new RenamedEventArgs((WatcherChangeTypes)0, null, string.Empty, string.Empty)); } } -} \ No newline at end of file +} diff --git a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetAttributes.cs b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetAttributes.cs index e2cd972..9c94c06 100644 --- a/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetAttributes.cs +++ b/src/libraries/System.IO.FileSystem/tests/DirectoryInfo/GetSetAttributes.cs @@ -85,7 +85,7 @@ namespace System.IO.Tests [Theory] [InlineData(~FileAttributes.ReadOnly)] - [InlineData(-1)] + [InlineData((FileAttributes)(-1))] [PlatformSpecific(TestPlatforms.AnyUnix)] // Unix-invalid file attributes that throw public void UnixInvalidAttributes_ThrowArgumentException(FileAttributes attr) { @@ -96,7 +96,7 @@ namespace System.IO.Tests [Theory] [InlineData(FileAttributes.Temporary)] [InlineData(~FileAttributes.ReadOnly)] - [InlineData(-1)] + [InlineData((FileAttributes)(-1))] [PlatformSpecific(TestPlatforms.Windows)] // Windows-invalid file attributes that throw public void WindowsInvalidAttributes_ThrowArgumentException(FileAttributes attr) { diff --git a/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CreateServer.cs b/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CreateServer.cs index e486fa0..3e25965 100644 --- a/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CreateServer.cs +++ b/src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CreateServer.cs @@ -31,8 +31,8 @@ namespace System.IO.Pipes.Tests } [Theory] - [InlineData(PipeDirection.In, 999)] - [InlineData(PipeDirection.Out, 999)] + [InlineData(PipeDirection.In, (HandleInheritability)999)] + [InlineData(PipeDirection.Out, (HandleInheritability)999)] public static void ServerBadInheritabilityThrows(PipeDirection direction, HandleInheritability inheritability) { AssertExtensions.Throws("inheritability", () => new AnonymousPipeServerStream(direction, inheritability)); diff --git a/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs b/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs index aa85689..7a9b57a 100644 --- a/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs +++ b/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs @@ -143,25 +143,6 @@ namespace System.Net.Tests Assert.Equal(hasEntityBody, request.HasEntityBody); } - [Theory] - [InlineData(100)] - [InlineData("-100")] - [InlineData("")] - [InlineData("abc")] - [InlineData("9223372036854775808")] - [ActiveIssue(20294, TargetFrameworkMonikers.Netcoreapp)] - public async Task ContentLength_ManuallySetInHeaders_ReturnsExpected(string newValue) - { - HttpListenerRequest request = await GetRequest("POST", null, new string[] { "Content-Length: 1" }, content: "\r\n"); - Assert.Equal("1", request.Headers["Content-Length"]); - - request.Headers.Set("Content-Length", newValue); - Assert.Equal(newValue, request.Headers["Content-Length"]); - Assert.Equal(1, request.ContentLength64); - - Assert.True(request.HasEntityBody); - } - [Fact] [ActiveIssue(20294, TargetFrameworkMonikers.Netcoreapp)] public async Task ContentLength_ManuallyRemovedFromHeaders_DoesNotAffect() diff --git a/src/libraries/System.Reflection/tests/ModuleTests.cs b/src/libraries/System.Reflection/tests/ModuleTests.cs index 4d754a0..d174473 100644 --- a/src/libraries/System.Reflection/tests/ModuleTests.cs +++ b/src/libraries/System.Reflection/tests/ModuleTests.cs @@ -22,8 +22,9 @@ namespace System.Reflection.Tests [InlineData(typeof(int))] [InlineData(typeof(List<>))] [InlineData(typeof(ModuleTest))] - public void Assembly(TypeInfo typeInfo) + public void Assembly(Type type) { + TypeInfo typeInfo = type.GetTypeInfo(); Module module = typeInfo.Module; Assert.Equal(typeInfo.Assembly, module.Assembly); } diff --git a/src/libraries/System.Runtime/tests/System/Reflection/AssemblyFlagsAttributeTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/AssemblyFlagsAttributeTests.cs index 0d364fb..673c9cb 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/AssemblyFlagsAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/AssemblyFlagsAttributeTests.cs @@ -16,7 +16,7 @@ namespace System.Reflection.Tests [InlineData(AssemblyNameFlags.EnableJITcompileTracking)] [InlineData(AssemblyNameFlags.PublicKey)] [InlineData(AssemblyNameFlags.Retargetable)] - [InlineData(int.MinValue)] + [InlineData((AssemblyNameFlags)int.MinValue)] [InlineData((AssemblyNameFlags)(AssemblyNameFlags.None - 1))] [InlineData((AssemblyNameFlags)int.MaxValue)] public void Ctor_AssemblyNameFlags(AssemblyNameFlags assemblyFlags) diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadNamedBitList.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadNamedBitList.cs index f5f2358..b0917c4 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadNamedBitList.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadNamedBitList.cs @@ -48,50 +48,50 @@ namespace System.Security.Cryptography.Tests.Asn1 [InlineData( PublicEncodingRules.BER, typeof(X509KeyUsageCSharpStyle), - X509KeyUsageCSharpStyle.None, + (long)(X509KeyUsageCSharpStyle.None), "030100")] [InlineData( PublicEncodingRules.CER, typeof(X509KeyUsageCSharpStyle), - X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign, + (long)(X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign), "0303070480")] [InlineData( PublicEncodingRules.DER, typeof(X509KeyUsageCSharpStyle), - X509KeyUsageCSharpStyle.KeyAgreement, + (long)(X509KeyUsageCSharpStyle.KeyAgreement), "03020308")] [InlineData( PublicEncodingRules.BER, typeof(LongFlags), - LongFlags.Mid | LongFlags.Max, + (long)(LongFlags.Mid | LongFlags.Max), "0309010000000080000002")] [InlineData( PublicEncodingRules.CER, typeof(LongFlags), - LongFlags.Mid | LongFlags.Min, + (long)(LongFlags.Mid | LongFlags.Min), "0309000000000080000001")] [InlineData( PublicEncodingRules.DER, typeof(LongFlags), - LongFlags.Min | LongFlags.Max, + (long)(LongFlags.Min | LongFlags.Max), "0309000000000000000003")] // BER: Unused bits are unmapped, regardless of value. [InlineData( PublicEncodingRules.BER, typeof(X509KeyUsageCSharpStyle), - X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign, + (long)(X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign), "030307048F")] // BER: Trailing zeros are permitted. [InlineData( PublicEncodingRules.BER, typeof(X509KeyUsageCSharpStyle), - X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign | X509KeyUsageCSharpStyle.DataEncipherment, + (long)(X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign | X509KeyUsageCSharpStyle.DataEncipherment), "03050014800000")] // BER: Trailing 0-bits don't have to be declared "unused" [InlineData( PublicEncodingRules.BER, typeof(X509KeyUsageCSharpStyle), - X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign | X509KeyUsageCSharpStyle.DataEncipherment, + (long)(X509KeyUsageCSharpStyle.DecipherOnly | X509KeyUsageCSharpStyle.KeyCertSign | X509KeyUsageCSharpStyle.DataEncipherment), "0303001480")] public static void VerifyReadNamedBitListEncodings( PublicEncodingRules ruleSet, @@ -111,17 +111,17 @@ namespace System.Security.Cryptography.Tests.Asn1 [InlineData( PublicEncodingRules.BER, typeof(ULongFlags), - ULongFlags.Mid | ULongFlags.Max, + (ulong)(ULongFlags.Mid | ULongFlags.Max), "0309000000000080000001")] [InlineData( PublicEncodingRules.CER, typeof(ULongFlags), - ULongFlags.Min | ULongFlags.Mid, + (ulong)(ULongFlags.Min | ULongFlags.Mid), "0306078000000080")] [InlineData( PublicEncodingRules.DER, typeof(ULongFlags), - ULongFlags.Min | ULongFlags.Max, + (ulong)(ULongFlags.Min | ULongFlags.Max), "0309008000000000000001")] public static void VerifyReadNamedBitListEncodings_ULong( PublicEncodingRules ruleSet, diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteInteger.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteInteger.cs index 6ec66f4..05c9b39 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteInteger.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteInteger.cs @@ -261,7 +261,7 @@ namespace System.Security.Cryptography.Tests.Asn1 } [Theory] - [InlineData(PublicEncodingRules.BER, 0, "D00100")] + [InlineData(PublicEncodingRules.BER, "0", "D00100")] [InlineData(PublicEncodingRules.BER, "1339673755198158349044581307228491520", "D0100102030405060708090A0B0C0D0E0F00")] [InlineData(PublicEncodingRules.CER, "320182027492359845421654932427609477120", "D01100F0E0D0C0B0A090807060504030201000")] [InlineData(PublicEncodingRules.DER, "-1339673755198158349044581307228491520", "D010FEFDFCFBFAF9F8F7F6F5F4F3F2F1F100")] diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.netcoreapp.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.netcoreapp.cs index fbb391c..a6f2f9e 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.netcoreapp.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.netcoreapp.cs @@ -148,8 +148,8 @@ namespace System.ServiceModel.Syndication.Tests } [Theory] - [InlineData(-1)] - [InlineData(24)] + [InlineData("-1")] + [InlineData("24")] [InlineData("invalid")] [InlineData("")] public void SkipHours_GetWithInvalidElementExtension_ThrowsFormatException(string value) diff --git a/src/libraries/System.Text.Json/tests/JsonDocumentTests.cs b/src/libraries/System.Text.Json/tests/JsonDocumentTests.cs index 1315913..fa15907 100644 --- a/src/libraries/System.Text.Json/tests/JsonDocumentTests.cs +++ b/src/libraries/System.Text.Json/tests/JsonDocumentTests.cs @@ -2237,7 +2237,7 @@ namespace System.Text.Json.Tests [Theory] [InlineData(-1)] - [InlineData(JsonCommentHandling.Allow)] + [InlineData((int)JsonCommentHandling.Allow)] [InlineData(3)] [InlineData(byte.MaxValue)] [InlineData(byte.MaxValue + 3)] // Other values, like byte.MaxValue + 1 overflows to 0 (i.e. JsonCommentHandling.Disallow), which is valid. diff --git a/src/libraries/System.Text.Json/tests/Serialization/OptionsTests.cs b/src/libraries/System.Text.Json/tests/Serialization/OptionsTests.cs index cc37f95..5d0416d 100644 --- a/src/libraries/System.Text.Json/tests/Serialization/OptionsTests.cs +++ b/src/libraries/System.Text.Json/tests/Serialization/OptionsTests.cs @@ -206,7 +206,7 @@ namespace System.Text.Json.Serialization.Tests [Theory] [InlineData(-1)] - [InlineData(JsonCommentHandling.Allow)] + [InlineData((int)JsonCommentHandling.Allow)] [InlineData(3)] [InlineData(byte.MaxValue)] [InlineData(byte.MaxValue + 3)] // Other values, like byte.MaxValue + 1 overflows to 0 (i.e. JsonCommentHandling.Disallow), which is valid. diff --git a/src/libraries/System.Utf8String.Experimental/tests/System/Char8Tests.cs b/src/libraries/System.Utf8String.Experimental/tests/System/Char8Tests.cs index 7f3a132..87da26b 100644 --- a/src/libraries/System.Utf8String.Experimental/tests/System/Char8Tests.cs +++ b/src/libraries/System.Utf8String.Experimental/tests/System/Char8Tests.cs @@ -13,9 +13,9 @@ namespace System.Tests [InlineData(10, 20, -1)] [InlineData(20, 10, 1)] [InlineData(30, 30, 0)] - public static void CompareTo(Char8 a, Char8 b, int expectedSign) + public static void CompareTo(int a, int b, int expectedSign) { - Assert.Equal(expectedSign, Math.Sign(a.CompareTo(b))); + Assert.Equal(expectedSign, Math.Sign(((Char8)a).CompareTo((Char8)b))); } [Theory] @@ -70,7 +70,7 @@ namespace System.Tests [InlineData(10, 20, false)] [InlineData(20, 10, false)] [InlineData(30, 30, true)] - public static void OperatorEquals(Char8 a, Char8 b, bool expected) + public static void OperatorEquals(int a, int b, bool expected) { Assert.Equal(expected, (Char8)a == (Char8)b); Assert.NotEqual(expected, (Char8)a != (Char8)b); @@ -82,7 +82,7 @@ namespace System.Tests [InlineData(29, 30, true)] [InlineData(30, 30, false)] [InlineData(31, 30, false)] - public static void OperatorLessThan(Char8 a, Char8 b, bool expected) + public static void OperatorLessThan(int a, int b, bool expected) { Assert.Equal(expected, (Char8)a < (Char8)b); Assert.NotEqual(expected, (Char8)a >= (Char8)b); @@ -94,7 +94,7 @@ namespace System.Tests [InlineData(29, 30, false)] [InlineData(30, 30, false)] [InlineData(31, 30, true)] - public static void OperatorGreaterThan(Char8 a, Char8 b, bool expected) + public static void OperatorGreaterThan(int a, int b, bool expected) { Assert.Equal(expected, (Char8)a > (Char8)b); Assert.NotEqual(expected, (Char8)a <= (Char8)b); diff --git a/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs b/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs index c1eca07..56b444b 100644 --- a/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs +++ b/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs @@ -258,9 +258,9 @@ namespace System.Web.Tests [MemberData(nameof(HtmlEncodeData))] [InlineData(null, null)] [InlineData(2, "2")] - public void HtmlEncodeObject(string decoded, string encoded) + public void HtmlEncodeObject(object decoded, string encoded) { - Assert.Equal(encoded, HttpUtility.HtmlEncode((object)decoded)); + Assert.Equal(encoded, HttpUtility.HtmlEncode(decoded)); } [Theory] -- 2.7.4