Example #1
0
        public void Streaming_V1()
        {
            Cid cid    = "zBunRGrmCGokA1oMESGGTfrtcMFsVA8aEtcNzM54akPWXF97uXCqTjF3GZ9v8YzxHrG66J8QhtPFWwZebRZ2zeUEELu67";
            var stream = new MemoryStream();

            cid.Write(stream);
            stream.Position = 0;
            Cid clone = Cid.Read(stream);

            Assert.AreEqual(cid.Version, clone.Version);
            Assert.AreEqual(cid.ContentType, clone.ContentType);
            Assert.AreEqual(cid.Hash, clone.Hash);
        }
Example #2
0
        public void Streaming_V0()
        {
            Cid cid    = "QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4";
            var stream = new MemoryStream();

            cid.Write(stream);
            stream.Position = 0;
            Cid clone = Cid.Read(stream);

            Assert.AreEqual(cid.Version, clone.Version);
            Assert.AreEqual(cid.ContentType, clone.ContentType);
            Assert.AreEqual(cid.Hash, clone.Hash);
        }
Example #3
0
        public void Protobuf_V1()
        {
            Cid cid    = "zBunRGrmCGokA1oMESGGTfrtcMFsVA8aEtcNzM54akPWXF97uXCqTjF3GZ9v8YzxHrG66J8QhtPFWwZebRZ2zeUEELu67";
            var stream = new MemoryStream();
            var cos    = new CodedOutputStream(stream);

            cid.Write(cos);
            cos.Flush();
            stream.Position = 0;
            var cis   = new CodedInputStream(stream);
            Cid clone = Cid.Read(cis);

            Assert.AreEqual(cid.Version, clone.Version);
            Assert.AreEqual(cid.ContentType, clone.ContentType);
            Assert.AreEqual(cid.Hash, clone.Hash);
        }
Example #4
0
        public void Protobuf_V0()
        {
            Cid cid    = "QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4";
            var stream = new MemoryStream();
            var cos    = new CodedOutputStream(stream);

            cid.Write(cos);
            cos.Flush();
            stream.Position = 0;
            var cis   = new CodedInputStream(stream);
            Cid clone = Cid.Read(cis);

            Assert.AreEqual(cid.Version, clone.Version);
            Assert.AreEqual(cid.ContentType, clone.ContentType);
            Assert.AreEqual(cid.Hash, clone.Hash);
        }