コード例 #1
0
        public void SaveLoadTest()
        {
            SEALContext context = GlobalContext.Context;
            Plaintext   plain   = new Plaintext("6x^5 + 5x^4 + 4x^3 + 3x^2 + 2x^1 + 5");
            Plaintext   other   = new Plaintext();

            Assert.AreNotSame(plain, other);
            Assert.AreNotEqual(plain, other);

            using (MemoryStream stream = new MemoryStream())
            {
                plain.Save(stream);

                stream.Seek(offset: 0, loc: SeekOrigin.Begin);

                other.Load(context, stream);
            }

            Assert.AreNotSame(plain, other);
            Assert.AreEqual(plain, other);
            Assert.IsTrue(other.IsMetadataValidFor(context));
        }