public virtual void TestProtoVector(ConcatVectorTest.DenseTestVector d1, ConcatVectorTest.DenseTestVector d2) { double expected = d1.vector.DotProduct(d2.vector); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); System.Diagnostics.Debug.Assert((d1.vector.GetType() == typeof(ConcatVector))); d1.vector.WriteToStream(byteArrayOutputStream); byteArrayOutputStream.Close(); byte[] bytes = byteArrayOutputStream.ToByteArray(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); ConcatVector recovered = ConcatVector.ReadFromStream(byteArrayInputStream); NUnit.Framework.Assert.AreEqual(recovered.DotProduct(d2.vector), 5.0e-4, expected); }