Test.CBORObjectTest.TestDecodeFromBytesNoDuplicateKeys C# (CSharp) Méthode

TestDecodeFromBytesNoDuplicateKeys() private méthode

private TestDecodeFromBytesNoDuplicateKeys ( ) : void
Résultat void
        public void TestDecodeFromBytesNoDuplicateKeys()
        {
            byte[] bytes;
              bytes = new byte[] { 0xa2, 0x01, 0x00, 0x02, 0x03 };
              try {
            CBORObject.DecodeFromBytes(bytes, CBOREncodeOptions.NoDuplicateKeys);
              } catch (Exception ex) {
            Assert.Fail(ex.ToString());
            throw new InvalidOperationException(String.Empty, ex);
              }
              bytes = new byte[] { 0xa2, 0x01, 0x00, 0x01, 0x03 };
              try {
            CBORObject.DecodeFromBytes(bytes, CBOREncodeOptions.NoDuplicateKeys);
            Assert.Fail("Should have failed");
              } catch (CBORException) {
            new Object();
              } catch (Exception ex) {
            Assert.Fail(ex.ToString());
            throw new InvalidOperationException(String.Empty, ex);
              }
              bytes = new byte[] { 0xa2, 0x01, 0x00, 0x01, 0x03 };
              try {
            CBORObject.DecodeFromBytes(bytes, CBOREncodeOptions.None);
              } catch (Exception ex) {
            Assert.Fail(ex.ToString());
            throw new InvalidOperationException(String.Empty, ex);
              }
              bytes = new byte[] { 0xa2, 0x60, 0x00, 0x60, 0x03 };
              try {
            CBORObject.DecodeFromBytes(bytes, CBOREncodeOptions.NoDuplicateKeys);
            Assert.Fail("Should have failed");
              } catch (CBORException) {
            new Object();
              } catch (Exception ex) {
            Assert.Fail(ex.ToString());
            throw new InvalidOperationException(String.Empty, ex);
              }
               bytes = new byte[] { 0xa3, 0x60, 0x00, 0x62, 0x41, 0x41, 0x00, 0x60, 0x03 };
              try {
            CBORObject.DecodeFromBytes(bytes, CBOREncodeOptions.NoDuplicateKeys);
            Assert.Fail("Should have failed");
              } catch (CBORException) {
            new Object();
              } catch (Exception ex) {
            Assert.Fail(ex.ToString());
            throw new InvalidOperationException(String.Empty, ex);
              }
              bytes = new byte[] { 0xa2, 0x61, 0x41, 0x00, 0x61, 0x41, 0x03 };
              try {
            CBORObject.DecodeFromBytes(bytes, CBOREncodeOptions.NoDuplicateKeys);
            Assert.Fail("Should have failed");
              } catch (CBORException) {
            new Object();
              } catch (Exception ex) {
            Assert.Fail(ex.ToString());
            throw new InvalidOperationException(String.Empty, ex);
              }
        }
CBORObjectTest