コード例 #1
0
        public virtual void TestProtoBatchModifier(ModelBatch batch)
        {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

            batch.WriteToStream(byteArrayOutputStream);
            byteArrayOutputStream.Close();
            byte[] bytes = byteArrayOutputStream.ToByteArray();
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
            ModelBatch           recovered            = new ModelBatch(byteArrayInputStream, null);

            byteArrayInputStream.Close();
            NUnit.Framework.Assert.AreEqual(batch.Count, recovered.Count);
            for (int i = 0; i < batch.Count; i++)
            {
                NUnit.Framework.Assert.AreEqual("true", recovered[i].GetModelMetaDataByReference()["testing"]);
            }
        }
コード例 #2
0
        public virtual void TestProtoBatch(ModelBatch batch)
        {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

            batch.WriteToStream(byteArrayOutputStream);
            byteArrayOutputStream.Close();
            byte[] bytes = byteArrayOutputStream.ToByteArray();
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
            ModelBatch           recovered            = new ModelBatch(byteArrayInputStream);

            byteArrayInputStream.Close();
            NUnit.Framework.Assert.AreEqual(batch.Count, recovered.Count);
            for (int i = 0; i < batch.Count; i++)
            {
                NUnit.Framework.Assert.IsTrue(batch[i].ValueEquals(recovered[i], 1.0e-5));
            }
        }