Address CborReader/Writer API review feedback (#37956)
authorEirik Tsarpalis <eirik.tsarpalis@gmail.com>
Thu, 18 Jun 2020 08:38:56 +0000 (09:38 +0100)
committerGitHub <noreply@github.com>
Thu, 18 Jun 2020 08:38:56 +0000 (09:38 +0100)
commit38192e3cbd5610c9fa3d814506424ad93dfa19b2
treed0defbfd55fbbdc11fa1076f8ed64de088a7b020
parent07f9116469d7964ba7468e7041d12ccd25f1d914
Address CborReader/Writer API review feedback (#37956)

* fix documentation issues

* simplify checks in PeekStateCore

* fix naming issue in CborReader

* apply dirty tricks

* rename CborConformanceLevel to CborConformanceMode

* change default conformance mode to strict

* add cls compliance attributes to offending members

* add CborWriter.Encode(Span<byte>) method

* make CborWriter.WriteStartArray/WriteStartMap methods accept nullable definiteLength parameters

* add WriteTextString(string?) and WriteByteString(byte[]?) methods

* address feedback

* s/None/Undefined/

* replace CborReader.HasData/BytesRead with CborReader.BytesRemaining

* rename Read/WriteCborNegativeIntegerEncoding to Read/WriteCborNegativeIntegerRepresentation

* add a disableConformanceModeChecks parameters to ReadEncodedValue

* make CborReader.PeekState() throw and remove format error enum values.

* move CborReader.SkipValue() implementation to a dedicated source file

* add ReadDefiniteLength(Byte|Text)String() methods

* split string tests into separate source files for each type

* implement CborContentException and use instead of FormatException

* address feedback
47 files changed:
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.ByteString.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Helpers.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Integer.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Simple.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.SkipValue.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.String.cs [deleted file]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.Tag.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.TextString.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborReaderTests.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborRoundtripTests.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.ByteString.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Helpers.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Integer.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Simple.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.String.cs [deleted file]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.Tag.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.TextString.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CborWriterTests.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor.Tests/CoseKeyHelpers.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborConformanceLevel.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborContentException.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborInitialByte.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Integer.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.PeekState.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Simple.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.SkipValue.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.String.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.Tag.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReader.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborReaderState.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborTag.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Array.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Integer.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Map.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Simple.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.String.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Tag.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.cs
src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/System.Formats.Cbor.Shared.projitems
src/libraries/System.Security.Cryptography.Encoding/tests/Resources/Strings.resx
src/libraries/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj