Ejemplo n.º 1
0
        public void WriteEndOnProperty_Close()
        {
            MemoryStream   ms     = new MemoryStream();
            CborDataWriter writer = new CborDataWriter(ms);

            writer.WriteStartObject();
            writer.WritePropertyName("Blah");
            writer.Close();

            Assert.AreEqual("0B-00-00-00-0A-42-6C-61-68-00-00", (BitConverter.ToString(ms.ToArray())));
        }
Ejemplo n.º 2
0
        public void CloseOutput()
        {
            MemoryStream   ms     = new MemoryStream();
            CborDataWriter writer = new CborDataWriter(ms);

            Assert.IsTrue(ms.CanRead);
            writer.Close();
            Assert.IsFalse(ms.CanRead);

            ms     = new MemoryStream();
            writer = new CborDataWriter(ms)
            {
                CloseOutput = false
            };

            Assert.IsTrue(ms.CanRead);
            writer.Close();
            Assert.IsTrue(ms.CanRead);
        }