From 7058aa0f0f279b81caee802ff8db83e0640d6675 Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Tue, 5 May 2020 18:55:22 +0100 Subject: [PATCH] Migrate CBOR classes to System.Formats.Cbor namespace (#35808) * Migrate CBOR classes to System.Formats.Cbor solution * move cbor source files back S.Security.Cryptography.Encoding * address feedback * remove all diffs from product csproj * move files to original locations * make cbor production classes public --- .../tests/Cbor.Tests/CborReaderTests.Array.cs | 10 ++-- .../tests/Cbor.Tests/CborReaderTests.Helpers.cs | 2 +- .../tests/Cbor.Tests/CborReaderTests.Integer.cs | 10 ++-- .../tests/Cbor.Tests/CborReaderTests.Map.cs | 20 ++++---- .../tests/Cbor.Tests/CborReaderTests.Simple.cs | 18 ++++---- .../tests/Cbor.Tests/CborReaderTests.SkipValue.cs | 8 ++-- .../tests/Cbor.Tests/CborReaderTests.String.cs | 26 +++++------ .../tests/Cbor.Tests/CborReaderTests.Tag.cs | 10 ++-- .../tests/Cbor.Tests/CborReaderTests.cs | 26 +++++------ .../tests/Cbor.Tests/CborRoundtripTests.cs | 2 +- .../tests/Cbor.Tests/CborWriterTests.Array.cs | 2 +- .../tests/Cbor.Tests/CborWriterTests.Helpers.cs | 2 +- .../tests/Cbor.Tests/CborWriterTests.Integer.cs | 2 +- .../tests/Cbor.Tests/CborWriterTests.Map.cs | 12 ++--- .../tests/Cbor.Tests/CborWriterTests.Simple.cs | 12 ++--- .../tests/Cbor.Tests/CborWriterTests.String.cs | 2 +- .../tests/Cbor.Tests/CborWriterTests.Tag.cs | 6 +-- .../tests/Cbor.Tests/CborWriterTests.cs | 6 +-- .../tests/Cbor/CborConformanceLevel.cs | 4 +- .../tests/Cbor/CborInitialByte.cs | 2 +- .../tests/Cbor/CborReader.Array.cs | 5 +- .../tests/Cbor/CborReader.Integer.cs | 4 +- .../tests/Cbor/CborReader.Map.cs | 4 +- .../tests/Cbor/CborReader.Simple.cs | 4 +- .../tests/Cbor/CborReader.SkipValue.cs | 4 +- .../tests/Cbor/CborReader.String.cs | 4 +- .../tests/Cbor/CborReader.Tag.cs | 8 ++-- .../tests/Cbor/CborReader.cs | 13 +++--- .../tests/Cbor/CborTag.cs | 6 +-- .../tests/Cbor/CborWriter.Array.cs | 6 +-- .../tests/Cbor/CborWriter.Integer.cs | 4 +- .../tests/Cbor/CborWriter.Map.cs | 9 ++-- .../tests/Cbor/CborWriter.Simple.cs | 4 +- .../tests/Cbor/CborWriter.String.cs | 4 +- .../tests/Cbor/CborWriter.Tag.cs | 4 +- .../tests/Cbor/CborWriter.cs | 4 +- .../Cbor/System.Formats.Cbor.Shared.projitems | 23 ++++++++++ ...tem.Security.Cryptography.Encoding.Tests.csproj | 53 +++++++--------------- 38 files changed, 171 insertions(+), 174 deletions(-) create mode 100644 src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/System.Formats.Cbor.Shared.projitems diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Array.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Array.cs index 2d64764..95d272c 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Array.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Array.cs @@ -7,7 +7,7 @@ using System; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -67,7 +67,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, "990000")] [InlineData(CborConformanceLevel.Strict, "9a00000000")] [InlineData(CborConformanceLevel.Strict, "9b0000000000000000")] - internal static void ReadArray_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadArray_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -85,7 +85,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Ctap2Canonical, "990000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "9a00000000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "9b0000000000000000")] - internal static void ReadArray_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadArray_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -96,7 +96,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Lax, "9fff")] [InlineData(CborConformanceLevel.Strict, "9fff")] - internal static void ReadArray_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadArray_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -107,7 +107,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Rfc7049Canonical, "9fff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "9fff")] - internal static void ReadArray_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadArray_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Helpers.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Helpers.cs index 63ad29c..04fd91a 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Helpers.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Helpers.cs @@ -8,7 +8,7 @@ using System.Numerics; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Integer.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Integer.cs index aad33de..87ae7d7 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Integer.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Integer.cs @@ -7,7 +7,7 @@ using System; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -169,7 +169,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, "1a0000ffff", ushort.MaxValue)] [InlineData(CborConformanceLevel.Strict, "1b00000000ffffffff", uint.MaxValue)] [InlineData(CborConformanceLevel.Strict, "1b0000000000000001", 1)] - internal static void ReadUInt64_NonCanonicalEncodings_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding, ulong expectedValue) + public static void ReadUInt64_NonCanonicalEncodings_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding, ulong expectedValue) { byte[] data = hexEncoding.HexToByteArray(); var reader = new CborReader(data, level); @@ -189,7 +189,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Ctap2Canonical, "1a0000ffff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "1b00000000ffffffff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "1b0000000000000001")] - internal static void ReadUInt64_NonCanonicalEncodings_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadUInt64_NonCanonicalEncodings_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] data = hexEncoding.HexToByteArray(); var reader = new CborReader(data, level); @@ -208,7 +208,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, "3a0000ffff", -1 - ushort.MaxValue)] [InlineData(CborConformanceLevel.Strict, "3b00000000ffffffff", -1 - uint.MaxValue)] [InlineData(CborConformanceLevel.Strict, "3b0000000000000000", -1)] - internal static void ReadInt64_NonCanonicalEncodings_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding, long expectedValue) + public static void ReadInt64_NonCanonicalEncodings_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding, long expectedValue) { byte[] data = hexEncoding.HexToByteArray(); var reader = new CborReader(data, level); @@ -228,7 +228,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Ctap2Canonical, "3a0000ffff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "3b00000000ffffffff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "3b0000000000000001")] - internal static void ReadInt64_NonCanonicalEncodings_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadInt64_NonCanonicalEncodings_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] data = hexEncoding.HexToByteArray(); var reader = new CborReader(data, level); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Map.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Map.cs index 31abc47..565f443 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Map.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Map.cs @@ -8,7 +8,7 @@ using System.Linq; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -71,7 +71,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Lax, "bfff")] [InlineData(CborConformanceLevel.Strict, "bfff")] - internal static void ReadMap_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadMap_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -82,7 +82,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Rfc7049Canonical, "bfff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "bfff")] - internal static void ReadMap_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadMap_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -99,7 +99,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, "b90000")] [InlineData(CborConformanceLevel.Strict, "ba00000000")] [InlineData(CborConformanceLevel.Strict, "bb0000000000000000")] - internal static void ReadMap_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadMap_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -118,7 +118,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Ctap2Canonical, "b90000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "ba00000000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "bb0000000000000000")] - internal static void ReadMap_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadMap_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -146,7 +146,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, new object[] { Map, "", 0, 255, 0 }, "a2600018ff00")] [InlineData(CborConformanceLevel.Rfc7049Canonical, new object[] { Map, "", 0, 255, 0 }, "a2600018ff00")] [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { Map, 255, 0, "", 0 }, "a218ff006000")] - internal static void ReadMap_SimpleValues_ShouldAcceptKeysSortedAccordingToConformanceLevel(CborConformanceLevel level, object expectedValue, string hexEncoding) + public static void ReadMap_SimpleValues_ShouldAcceptKeysSortedAccordingToConformanceLevel(CborConformanceLevel level, object expectedValue, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -158,7 +158,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, new object[] { Map, -1, 0, new object[] { Map, 3, 3, 2, 2, 1, 1 }, 0, "a", 0, 256, 0, new object[] { Map, 2, 2, 1, 1 }, 0 }, "a52000a30303020201010061610019010000a20202010100")] [InlineData(CborConformanceLevel.Rfc7049Canonical, new object[] { Map, -1, 0, "a", 0, 256, 0, new object[] { Map, 1, 1, 2, 2 }, 0, new object[] { Map, 1, 1, 2, 2, 3, 3 }, 0 }, "a5200061610019010000a20101020200a301010202030300")] [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { Map, 256, 0, -1, 0, "a", 0, new object[] { Map, 1, 1, 2, 2 }, 0, new object[] { Map, 1, 1, 2, 2, 3, 3 }, 0 }, "a5190100002000616100a20101020200a301010202030300")] - internal static void ReadMap_NestedValues_ShouldAcceptKeysSortedAccordingToConformanceLevel(CborConformanceLevel level, object expectedValue, string hexEncoding) + public static void ReadMap_NestedValues_ShouldAcceptKeysSortedAccordingToConformanceLevel(CborConformanceLevel level, object expectedValue, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -185,7 +185,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, new object[] { new object[] { "x", "y" } }, "a28182617861790181826178617902")] [InlineData(CborConformanceLevel.Rfc7049Canonical, new object[] { new object[] { "x", "y" } }, "a28182617861790181826178617902")] [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { new object[] { "x", "y" } }, "a28182617861790181826178617902")] - internal static void ReadMap_DuplicateKeys_StrictConformance_ShouldThrowFormatException(CborConformanceLevel level, object dupeKey, string hexEncoding) + public static void ReadMap_DuplicateKeys_StrictConformance_ShouldThrowFormatException(CborConformanceLevel level, object dupeKey, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); reader.ReadStartMap(); @@ -209,7 +209,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, new object[] { 1, 2, 3, 0 }, "a40101020203030000")] [InlineData(CborConformanceLevel.Lax, new object[] { 1, "", 25, "a", 2 }, "a5010060001819006161000200")] [InlineData(CborConformanceLevel.Strict, new object[] { 1, 25, "", "a", 2 }, "a5010018190060006161000200")] - internal static void ReadMap_UnsortedKeys_ConformanceNotRequiringSortedKeys_ShouldSucceed(CborConformanceLevel level, object[] keySequence, string hexEncoding) + public static void ReadMap_UnsortedKeys_ConformanceNotRequiringSortedKeys_ShouldSucceed(CborConformanceLevel level, object[] keySequence, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); reader.ReadStartMap(); @@ -227,7 +227,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { 1, 2, 3, 0 }, "a40101020203030000")] [InlineData(CborConformanceLevel.Rfc7049Canonical, new object[] { 1, "", 25, "a", 2 }, "a5010060001819006161000200")] [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { 1, 25, "", "a", 2 }, "a5010018190060006161000200")] - internal static void ReadMap_UnsortedKeys_ConformanceRequiringSortedKeys_ShouldThrowFormatException(CborConformanceLevel level, object[] keySequence, string hexEncoding) + public static void ReadMap_UnsortedKeys_ConformanceRequiringSortedKeys_ShouldThrowFormatException(CborConformanceLevel level, object[] keySequence, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); reader.ReadStartMap(); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Simple.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Simple.cs index eab951e..6a9f50a 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Simple.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Simple.cs @@ -7,7 +7,7 @@ using System; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -20,7 +20,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(float.PositiveInfinity, "fa7f800000")] [InlineData(float.NegativeInfinity, "faff800000")] [InlineData(float.NaN, "fa7fc00000")] - internal static void ReadSingle_SingleValue_HappyPath(float expectedResult, string hexEncoding) + public static void ReadSingle_SingleValue_HappyPath(float expectedResult, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); @@ -38,7 +38,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(double.PositiveInfinity, "fb7ff0000000000000")] [InlineData(double.NegativeInfinity, "fbfff0000000000000")] [InlineData(double.NaN, "fb7ff8000000000000")] - internal static void ReadDouble_SingleValue_HappyPath(double expectedResult, string hexEncoding) + public static void ReadDouble_SingleValue_HappyPath(double expectedResult, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); @@ -54,7 +54,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(double.PositiveInfinity, "fa7f800000")] [InlineData(double.NegativeInfinity, "faff800000")] [InlineData(double.NaN, "fa7fc00000")] - internal static void ReadDouble_SinglePrecisionValue_ShouldCoerceToDouble(double expectedResult, string hexEncoding) + public static void ReadDouble_SinglePrecisionValue_ShouldCoerceToDouble(double expectedResult, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); @@ -76,7 +76,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(double.PositiveInfinity, "f97c00")] [InlineData(double.NaN, "f97e00")] [InlineData(double.NegativeInfinity, "f9fc00")] - internal static void ReadDouble_HalfPrecisionValue_ShouldCoerceToDouble(double expectedResult, string hexEncoding) + public static void ReadDouble_HalfPrecisionValue_ShouldCoerceToDouble(double expectedResult, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); @@ -98,7 +98,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(float.PositiveInfinity, "f97c00")] [InlineData(float.NaN, "f97e00")] [InlineData(float.NegativeInfinity, "f9fc00")] - internal static void ReadSingle_HalfPrecisionValue_ShouldCoerceToSingle(float expectedResult, string hexEncoding) + public static void ReadSingle_HalfPrecisionValue_ShouldCoerceToSingle(float expectedResult, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); @@ -109,7 +109,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor } [Fact] - internal static void ReadNull_SingleValue_HappyPath() + public static void ReadNull_SingleValue_HappyPath() { byte[] encoding = "f6".HexToByteArray(); var reader = new CborReader(encoding); @@ -121,7 +121,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(false, "f4")] [InlineData(true, "f5")] - internal static void ReadBoolean_SingleValue_HappyPath(bool expectedResult, string hexEncoding) + public static void ReadBoolean_SingleValue_HappyPath(bool expectedResult, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); @@ -139,7 +139,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborSimpleValue.Undefined, "f7")] [InlineData((CborSimpleValue)32, "f820")] [InlineData((CborSimpleValue)255, "f8ff")] - internal static void ReadSimpleValue_SingleValue_HappyPath(CborSimpleValue expectedResult, string hexEncoding) + public static void ReadSimpleValue_SingleValue_HappyPath(CborSimpleValue expectedResult, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.SkipValue.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.SkipValue.cs index 95b980e..0f84dbf 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.SkipValue.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.SkipValue.cs @@ -10,7 +10,7 @@ using System.Text; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -106,7 +106,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(NonConformingSkipValueEncodings))] - internal static void SkipValue_NonConformingValues_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void SkipValue_NonConformingValues_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -117,7 +117,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(NonConformingSkipValueEncodings))] - internal static void SkipValue_ValidationEnabled_NonConformingValues_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void SkipValue_ValidationEnabled_NonConformingValues_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -140,7 +140,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor }.Select(l => new object[] { l.Level, l.Encoding }); [Fact] - internal static void SkipValue_SkippedValueFollowedByNonConformingValue_ShouldThrowFormatException() + public static void SkipValue_SkippedValueFollowedByNonConformingValue_ShouldThrowFormatException() { byte[] encoding = "827fff7fff".HexToByteArray(); var reader = new CborReader(encoding, CborConformanceLevel.Ctap2Canonical); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.String.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.String.cs index 1f4d49b..45c1bb1 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.String.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.String.cs @@ -9,7 +9,7 @@ using System.Text; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -304,7 +304,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, "590000")] [InlineData(CborConformanceLevel.Strict, "5a00000000")] [InlineData(CborConformanceLevel.Strict, "5b0000000000000000")] - internal static void ReadByteString_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadByteString_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -322,7 +322,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Ctap2Canonical, "590000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "5a00000000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "5b0000000000000000")] - internal static void ReadByteString_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadByteString_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -339,7 +339,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, "790000")] [InlineData(CborConformanceLevel.Strict, "7a00000000")] [InlineData(CborConformanceLevel.Strict, "7b0000000000000000")] - internal static void ReadTextString_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadTextString_NonCanonicalLengths_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -357,7 +357,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Ctap2Canonical, "790000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "7a00000000")] [InlineData(CborConformanceLevel.Ctap2Canonical, "7b0000000000000000")] - internal static void ReadTextString_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadTextString_NonCanonicalLengths_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -368,7 +368,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Lax, "5f40ff")] [InlineData(CborConformanceLevel.Strict, "5f40ff")] - internal static void ReadByteString_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadByteString_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -380,7 +380,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Lax, "5f40ff")] [InlineData(CborConformanceLevel.Strict, "5f40ff")] - internal static void ReadByteString_IndefiniteLength_AsSingleItem_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadByteString_IndefiniteLength_AsSingleItem_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -390,7 +390,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Rfc7049Canonical, "5f40ff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "5f40ff")] - internal static void ReadByteString_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatExceptoin(CborConformanceLevel level, string hexEncoding) + public static void ReadByteString_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatExceptoin(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -401,7 +401,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Rfc7049Canonical, "5f40ff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "5f40ff")] - internal static void ReadByteString_IndefiniteLength_AsSingleItem_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadByteString_IndefiniteLength_AsSingleItem_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -412,7 +412,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Lax, "7f60ff")] [InlineData(CborConformanceLevel.Strict, "7f60ff")] - internal static void ReadTextString_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadTextString_IndefiniteLength_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -424,7 +424,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Lax, "7f60ff")] [InlineData(CborConformanceLevel.Strict, "7f60ff")] - internal static void ReadTextString_IndefiniteLength_AsSingleItem_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void ReadTextString_IndefiniteLength_AsSingleItem_SupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -434,7 +434,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Rfc7049Canonical, "7f60ff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "7f60ff")] - internal static void ReadTextString_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatExceptoin(CborConformanceLevel level, string hexEncoding) + public static void ReadTextString_IndefiniteLength_UnSupportedConformanceLevel_ShouldThrowFormatExceptoin(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); @@ -445,7 +445,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Rfc7049Canonical, "7f60ff")] [InlineData(CborConformanceLevel.Ctap2Canonical, "7f60ff")] - internal static void ReadTextString_IndefiniteLength_AsSingleItem_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) + public static void ReadTextString_IndefiniteLength_AsSingleItem_UnSupportedConformanceLevel_ShouldThrowFormatException(CborConformanceLevel level, string hexEncoding) { byte[] encoding = hexEncoding.HexToByteArray(); var reader = new CborReader(encoding, level); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Tag.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Tag.cs index 812a7f1..f1e2c21 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Tag.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Tag.cs @@ -10,7 +10,7 @@ using System.Numerics; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -477,7 +477,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(SupportedConformanceTaggedValues))] - internal static void ReadTaggedValue_SupportedConformance_ShouldSucceed(CborConformanceLevel level, object expectedValue, string hexEncoding) + public static void ReadTaggedValue_SupportedConformance_ShouldSucceed(CborConformanceLevel level, object expectedValue, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); Helpers.VerifyValue(reader, expectedValue); @@ -490,7 +490,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(UnsupportedConformanceTaggedValues))] - internal static void ReadTaggedValue_UnsupportedConformance_ShouldThrowFormatException(CborConformanceLevel level, object expectedValue, string hexEncoding) + public static void ReadTaggedValue_UnsupportedConformance_ShouldThrowFormatException(CborConformanceLevel level, object expectedValue, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); Assert.Throws(() => Helpers.VerifyValue(reader, expectedValue)); @@ -504,7 +504,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(TaggedValuesAnyConformance))] - internal static void PeekTag_UnsupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) + public static void PeekTag_UnsupportedConformanceLevel_ShouldSucceed(CborConformanceLevel level, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); reader.PeekTag(); @@ -517,7 +517,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(UnsupportedConformanceInvalidTypes))] - internal static void PeekTag_InvalidType_UnsupportedConformanceLevel_ShouldThrowInvalidOperationException(CborConformanceLevel level, string hexEncoding) + public static void PeekTag_InvalidType_UnsupportedConformanceLevel_ShouldThrowInvalidOperationException(CborConformanceLevel level, string hexEncoding) { var reader = new CborReader(hexEncoding.HexToByteArray(), level); Assert.Throws(() => reader.PeekTag()); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.cs index e61bda7..6a86f15 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.cs @@ -9,7 +9,7 @@ using System.Linq; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborReaderTests { @@ -59,17 +59,17 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor } [Theory] - [InlineData(CborMajorType.UnsignedInteger, CborReaderState.UnsignedInteger)] - [InlineData(CborMajorType.NegativeInteger, CborReaderState.NegativeInteger)] - [InlineData(CborMajorType.ByteString, CborReaderState.ByteString)] - [InlineData(CborMajorType.TextString, CborReaderState.TextString)] - [InlineData(CborMajorType.Array, CborReaderState.StartArray)] - [InlineData(CborMajorType.Map, CborReaderState.StartMap)] - [InlineData(CborMajorType.Tag, CborReaderState.Tag)] - [InlineData(CborMajorType.Simple, CborReaderState.SpecialValue)] - internal static void Peek_SingleByteBuffer_ShouldReturnExpectedState(CborMajorType majorType, CborReaderState expectedResult) - { - ReadOnlyMemory buffer = new byte[] { (byte)((byte)majorType << 5) }; + [InlineData(0, CborReaderState.UnsignedInteger)] + [InlineData(1, CborReaderState.NegativeInteger)] + [InlineData(2, CborReaderState.ByteString)] + [InlineData(3, CborReaderState.TextString)] + [InlineData(4, CborReaderState.StartArray)] + [InlineData(5, CborReaderState.StartMap)] + [InlineData(6, CborReaderState.Tag)] + [InlineData(7, CborReaderState.SpecialValue)] + public static void Peek_SingleByteBuffer_ShouldReturnExpectedState(byte majorType, CborReaderState expectedResult) + { + ReadOnlyMemory buffer = new byte[] { (byte)(majorType << 5) }; var reader = new CborReader(buffer); Assert.Equal(expectedResult, reader.PeekState()); } @@ -175,7 +175,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData((CborConformanceLevel)(-1))] - internal static void InvalidConformanceLevel_ShouldThrowArgumentOutOfRangeException(CborConformanceLevel level) + public static void InvalidConformanceLevel_ShouldThrowArgumentOutOfRangeException(CborConformanceLevel level) { Assert.Throws(() => new CborReader(Array.Empty(), conformanceLevel: level)); } diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborRoundtripTests.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborRoundtripTests.cs index 0853082..6f42333 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborRoundtripTests.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborRoundtripTests.cs @@ -11,7 +11,7 @@ using Xunit; using FsCheck.Xunit; #endif -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborRoundtripTests { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Array.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Array.cs index 42ac3cc..e43bffb 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Array.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Array.cs @@ -7,7 +7,7 @@ using System; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Helpers.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Helpers.cs index 039ff0a..9b6530f 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Helpers.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Helpers.cs @@ -9,7 +9,7 @@ using System.Numerics; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Integer.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Integer.cs index 1d914de..01ed262 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Integer.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Integer.cs @@ -7,7 +7,7 @@ using System; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Map.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Map.cs index 9307aa3..04755b4 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Map.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Map.cs @@ -6,9 +6,9 @@ using System; using Test.Cryptography; using Xunit; -//using static W = System.Security.Cryptography.Encoding.Tests.Cbor.CborWriterHelpers; +//using static W = System.Formats.Cbor.Tests.CborWriterHelpers; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { @@ -147,7 +147,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, new object[] { Map, "", 0, 255, 0 }, "a2600018ff00")] [InlineData(CborConformanceLevel.Rfc7049Canonical, new object[] { Map, "", 0, 255, 0 }, "a2600018ff00")] [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { Map, "", 0, 255, 0 }, "a218ff006000")] - internal static void WriteMap_SimpleValues_ShouldSortKeysAccordingToConformanceLevel(CborConformanceLevel level, object value, string expectedHexEncoding) + public static void WriteMap_SimpleValues_ShouldSortKeysAccordingToConformanceLevel(CborConformanceLevel level, object value, string expectedHexEncoding) { byte[] expectedEncoding = expectedHexEncoding.HexToByteArray(); using var writer = new CborWriter(level); @@ -161,7 +161,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData("a52000a30303020201010061610019010000a20202010100", CborConformanceLevel.Strict)] [InlineData("a5200061610019010000a20101020200a301010202030300", CborConformanceLevel.Rfc7049Canonical)] [InlineData("a5190100002000616100a20101020200a301010202030300", CborConformanceLevel.Ctap2Canonical)] - internal static void WriteMap_NestedValues_ShouldSortKeysAccordingToConformanceLevel(string expectedHexEncoding, CborConformanceLevel level) + public static void WriteMap_NestedValues_ShouldSortKeysAccordingToConformanceLevel(string expectedHexEncoding, CborConformanceLevel level) { object[] value = new object[] { Map, -1, 0, new object[] { Map, 3, 3, 2, 2, 1, 1 }, 0, "a", 0, 256, 0, new object[] { Map, 2, 2, 1, 1 }, 0 }; byte[] expectedEncoding = expectedHexEncoding.HexToByteArray(); @@ -192,7 +192,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, new object[] { new object[] { "x", "y" } })] [InlineData(CborConformanceLevel.Rfc7049Canonical, new object[] { new object[] { "x", "y" } })] [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { new object[] { "x", "y" } })] - internal static void WriteMap_DuplicateKeys_StrictConformance_ShouldFail(CborConformanceLevel level, object dupeKey) + public static void WriteMap_DuplicateKeys_StrictConformance_ShouldFail(CborConformanceLevel level, object dupeKey) { using var writer = new CborWriter(level); writer.WriteStartMap(2); @@ -211,7 +211,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborConformanceLevel.Strict, new object[] { new object[] { "x", "y" } })] [InlineData(CborConformanceLevel.Rfc7049Canonical, new object[] { new object[] { "x", "y" } })] [InlineData(CborConformanceLevel.Ctap2Canonical, new object[] { new object[] { "x", "y" } })] - internal static void WriteMap_DuplicateKeys_StrictConformance_ShouldBeRecoverableError(CborConformanceLevel level, object dupeKey) + public static void WriteMap_DuplicateKeys_StrictConformance_ShouldBeRecoverableError(CborConformanceLevel level, object dupeKey) { byte[] expected = PerformWrite(attemptDuplicateWrite: false); byte[] actual = PerformWrite(attemptDuplicateWrite: true); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Simple.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Simple.cs index 1135d0b..7788416 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Simple.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Simple.cs @@ -7,7 +7,7 @@ using System; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { @@ -20,7 +20,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(float.PositiveInfinity, "fa7f800000")] [InlineData(float.NegativeInfinity, "faff800000")] [InlineData(float.NaN, "faffc00000")] - internal static void WriteSingle_SingleValue_HappyPath(float input, string hexExpectedEncoding) + public static void WriteSingle_SingleValue_HappyPath(float input, string hexExpectedEncoding) { byte[] expectedEncoding = hexExpectedEncoding.HexToByteArray(); using var writer = new CborWriter(); @@ -36,7 +36,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(double.PositiveInfinity, "fb7ff0000000000000")] [InlineData(double.NegativeInfinity, "fbfff0000000000000")] [InlineData(double.NaN, "fbfff8000000000000")] - internal static void WriteDouble_SingleValue_HappyPath(double input, string hexExpectedEncoding) + public static void WriteDouble_SingleValue_HappyPath(double input, string hexExpectedEncoding) { byte[] expectedEncoding = hexExpectedEncoding.HexToByteArray(); using var writer = new CborWriter(); @@ -45,7 +45,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor } [Fact] - internal static void WriteNull_SingleValue_HappyPath() + public static void WriteNull_SingleValue_HappyPath() { byte[] expectedEncoding = "f6".HexToByteArray(); using var writer = new CborWriter(); @@ -56,7 +56,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(false, "f4")] [InlineData(true, "f5")] - internal static void WriteBoolean_SingleValue_HappyPath(bool input, string hexExpectedEncoding) + public static void WriteBoolean_SingleValue_HappyPath(bool input, string hexExpectedEncoding) { byte[] expectedEncoding = hexExpectedEncoding.HexToByteArray(); using var writer = new CborWriter(); @@ -72,7 +72,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [InlineData(CborSimpleValue.Undefined, "f7")] [InlineData((CborSimpleValue)32, "f820")] [InlineData((CborSimpleValue)255, "f8ff")] - internal static void WriteSimpleValue_SingleValue_HappyPath(CborSimpleValue input, string hexExpectedEncoding) + public static void WriteSimpleValue_SingleValue_HappyPath(CborSimpleValue input, string hexExpectedEncoding) { byte[] expectedEncoding = hexExpectedEncoding.HexToByteArray(); using var writer = new CborWriter(); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.String.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.String.cs index 9344920..ba23aba 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.String.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.String.cs @@ -8,7 +8,7 @@ using System.Linq; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Tag.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Tag.cs index f6550122..8c9e20d 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Tag.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Tag.cs @@ -11,7 +11,7 @@ using System.Numerics; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { @@ -181,7 +181,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(UnsupportedConformanceTaggedValues))] - internal static void WriteTaggedValue_UnsupportedConformance_ShouldThrowInvalidOperationException(CborConformanceLevel level, object value) + public static void WriteTaggedValue_UnsupportedConformance_ShouldThrowInvalidOperationException(CborConformanceLevel level, object value) { using var writer = new CborWriter(level); Assert.Throws(() => Helpers.WriteValue(writer, value)); @@ -195,7 +195,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [MemberData(nameof(SupportedConformanceTaggedValues))] - internal static void WriteTaggedValue_SupportedConformance_ShouldSucceed(CborConformanceLevel level, object value) + public static void WriteTaggedValue_SupportedConformance_ShouldSucceed(CborConformanceLevel level, object value) { using var writer = new CborWriter(level); Helpers.WriteValue(writer, value); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.cs index e661a59..c6db6b5 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.cs @@ -9,7 +9,7 @@ using System.Linq; using Test.Cryptography; using Xunit; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor.Tests { public partial class CborWriterTests { @@ -238,7 +238,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData((CborConformanceLevel)(-1))] - internal static void InvalidConformanceLevel_ShouldThrowArgumentOutOfRangeException(CborConformanceLevel level) + public static void InvalidConformanceLevel_ShouldThrowArgumentOutOfRangeException(CborConformanceLevel level) { Assert.Throws(() => new CborWriter(conformanceLevel: level)); } @@ -246,7 +246,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor [Theory] [InlineData(CborConformanceLevel.Rfc7049Canonical)] [InlineData(CborConformanceLevel.Ctap2Canonical)] - internal static void EncodeIndefiniteLengths_UnsupportedConformanceLevel_ShouldThrowArgumentException(CborConformanceLevel level) + public static void EncodeIndefiniteLengths_UnsupportedConformanceLevel_ShouldThrowArgumentException(CborConformanceLevel level) { Assert.Throws(() => new CborWriter(level, encodeIndefiniteLengths: true)); } diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborConformanceLevel.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborConformanceLevel.cs index ef95472..4a6fa86 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborConformanceLevel.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborConformanceLevel.cs @@ -4,9 +4,9 @@ using System.Diagnostics; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal enum CborConformanceLevel + public enum CborConformanceLevel { Lax = 0, Strict = 1, diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborInitialByte.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborInitialByte.cs index 185097e..c99a838 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborInitialByte.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborInitialByte.cs @@ -4,7 +4,7 @@ using System.Diagnostics; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { internal enum CborMajorType : byte { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Array.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Array.cs index aef8b12..22ba363 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Array.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Array.cs @@ -3,11 +3,10 @@ // See the LICENSE file in the project root for more information. #nullable enable -using System.Buffers.Binary; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborReader + public partial class CborReader { public int? ReadStartArray() { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Integer.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Integer.cs index 53c5b1c..d1f4546 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Integer.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Integer.cs @@ -5,9 +5,9 @@ using System.Buffers.Binary; using System.Xml; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborReader + public partial class CborReader { // Implements major type 0,1 decoding per https://tools.ietf.org/html/rfc7049#section-2.1 diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Map.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Map.cs index 1299dc9..dfd15bf 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Map.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Map.cs @@ -8,9 +8,9 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Threading; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborReader + public partial class CborReader { private KeyEncodingComparer? _keyEncodingComparer; private Stack>? _pooledKeyEncodingRangeSets; diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Simple.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Simple.cs index 67ebf93..f98b55a 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Simple.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Simple.cs @@ -4,9 +4,9 @@ using System.Buffers.Binary; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborReader + public partial class CborReader { public float ReadSingle() { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.SkipValue.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.SkipValue.cs index 650ac4c..d497f71 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.SkipValue.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.SkipValue.cs @@ -5,9 +5,9 @@ #nullable enable using System.Diagnostics; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborReader + public partial class CborReader { public void SkipValue(bool validateConformance = false) => SkipToAncestor(0, validateConformance); public void SkipToParent(bool validateConformance = false) diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.String.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.String.cs index edf1357..5dbf0d5 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.String.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.String.cs @@ -8,9 +8,9 @@ using System.Diagnostics; using System.Text; using System.Threading; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborReader + public partial class CborReader { private static readonly System.Text.Encoding s_utf8Encoding = new System.Text.UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Tag.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Tag.cs index eec82b7..26b2f8d 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Tag.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Tag.cs @@ -5,9 +5,9 @@ using System.Globalization; using System.Numerics; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborReader + public partial class CborReader { public CborTag ReadTag() { @@ -142,7 +142,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor _ => throw new InvalidOperationException("CBOR tag is not a recognized Bignum value."), }; - switch(PeekState()) + switch (PeekState()) { case CborReaderState.ByteString: case CborReaderState.StartByteString: @@ -202,7 +202,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor break; case CborReaderState.Tag: - switch(PeekTag()) + switch (PeekTag()) { case CborTag.UnsignedBigNum: case CborTag.NegativeBigNum: diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.cs index 9d2f47f..eddb5f2 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.cs @@ -5,11 +5,10 @@ #nullable enable using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal enum CborReaderState + public enum CborReaderState { Unknown = 0, UnsignedInteger, @@ -37,7 +36,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor FormatError, } - internal partial class CborReader + public partial class CborReader { private readonly ReadOnlyMemory _originalBuffer; private ReadOnlyMemory _buffer; @@ -62,7 +61,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor // keeps a cached copy of the reader state; 'Unknown' denotes uncomputed state private CborReaderState _cachedState = CborReaderState.Unknown; - internal CborReader(ReadOnlyMemory buffer, CborConformanceLevel conformanceLevel = CborConformanceLevel.Lax, bool allowMultipleRootLevelValues = false) + public CborReader(ReadOnlyMemory buffer, CborConformanceLevel conformanceLevel = CborConformanceLevel.Lax, bool allowMultipleRootLevelValues = false) { CborConformanceLevelHelpers.Validate(conformanceLevel); @@ -368,7 +367,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor { if (_currentKeyOffset != null) // is map context { - if(_currentItemIsKey) + if (_currentItemIsKey) { HandleMapKeyRead(); } @@ -505,7 +504,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor Debug.Assert( (stackOffset == 0) ? _frameOffset == checkpoint.FrameOffset : - _nestedDataItems.Skip(stackOffset - 1).FirstOrDefault().FrameOffset == checkpoint.FrameOffset, + _nestedDataItems.ToArray()[stackOffset - 1].FrameOffset == checkpoint.FrameOffset, "Attempting to restore checkpoint outside of its original context."); // pop any nested data items introduced after the checkpoint diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborTag.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborTag.cs index 7659530..23cafd2 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborTag.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborTag.cs @@ -2,10 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace System.Security.Cryptography.Encoding.Tests +namespace System.Formats.Cbor { // https://tools.ietf.org/html/rfc7049#section-2.4 - internal enum CborTag : ulong + public enum CborTag : ulong { DateTimeString = 0, UnixTimeSeconds = 1, @@ -29,7 +29,7 @@ namespace System.Security.Cryptography.Encoding.Tests } // https://tools.ietf.org/html/rfc7049#section-2.3 - internal enum CborSimpleValue : byte + public enum CborSimpleValue : byte { False = 20, True = 21, diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Array.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Array.cs index a6d58a3..d2d8f13 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Array.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Array.cs @@ -3,13 +3,11 @@ // See the LICENSE file in the project root for more information. #nullable enable -using System.Buffers.Binary; using System.Diagnostics; -using System.Text; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborWriter + public partial class CborWriter { public void WriteStartArray(int definiteLength) { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Integer.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Integer.cs index 80bcd5c..626a699 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Integer.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Integer.cs @@ -4,9 +4,9 @@ using System.Buffers.Binary; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborWriter + public partial class CborWriter { // Implements major type 0 encoding per https://tools.ietf.org/html/rfc7049#section-2.1 public void WriteUInt64(ulong value) diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Map.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Map.cs index 336db50..75c2497 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Map.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Map.cs @@ -3,15 +3,12 @@ // See the LICENSE file in the project root for more information. #nullable enable -using System.Buffers; using System.Collections.Generic; -using System.Collections.Immutable; using System.Diagnostics; -using System.Threading; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborWriter + public partial class CborWriter { private KeyEncodingComparer? _keyEncodingComparer; private Stack>? _pooledKeyEncodingRangeSets; @@ -152,7 +149,7 @@ namespace System.Security.Cryptography.Encoding.Tests.Cbor if (_pooledKeyEncodingRangeSets != null && _pooledKeyEncodingRangeSets.TryPop(out HashSet<(int Offset, int Length)>? result)) - { + { result.Clear(); return _keyEncodingRanges = result; } diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Simple.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Simple.cs index e3e9467..56d8133 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Simple.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Simple.cs @@ -4,9 +4,9 @@ using System.Buffers.Binary; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborWriter + public partial class CborWriter { // Implements https://tools.ietf.org/html/rfc7049#section-2.3 diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.String.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.String.cs index 45ef447..ca7cbc8 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.String.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.String.cs @@ -9,9 +9,9 @@ using System.Diagnostics; using System.Text; using System.Threading; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborWriter + public partial class CborWriter { private static readonly System.Text.Encoding s_utf8Encoding = new System.Text.UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Tag.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Tag.cs index 6a256e7..39980ce 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Tag.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Tag.cs @@ -5,9 +5,9 @@ using System.Diagnostics; using System.Numerics; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborWriter + public partial class CborWriter { public void WriteTag(CborTag tag) { diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.cs index 31a6fc0..2b77f2d 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.Threading; -namespace System.Security.Cryptography.Encoding.Tests.Cbor +namespace System.Formats.Cbor { - internal partial class CborWriter : IDisposable + public partial class CborWriter : IDisposable { // TODO : determine if CryptoPool is more appropriate private static readonly ArrayPool s_bufferPool = ArrayPool.Create(); diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/System.Formats.Cbor.Shared.projitems b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/System.Formats.Cbor.Shared.projitems new file mode 100644 index 0000000..e557599 --- /dev/null +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/System.Formats.Cbor.Shared.projitems @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj b/src/libraries/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj index 0c14200..8ca3935 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj @@ -5,9 +5,7 @@ - - + @@ -48,52 +46,35 @@ + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.7.4