public void FromStream_creates_correct_Object() { var typeMap = scope.Resolve <TypeMap>(); using (var ms = new MemoryStream()) using (var sw = new ZetboxStreamWriter(typeMap, new BinaryWriter(ms))) using (var sr = new ZetboxStreamReader(typeMap, new BinaryReader(ms))) { Assert.Ignore("need to implement mocked serialization for ObjectClass"); //TestObjClassSerializationMock.ToStream<TestObjClass, int>(sw); sw.Flush(); Assert.That(ms.Length, Is.GreaterThan(0)); ms.Seek(0, SeekOrigin.Begin); obj.FromStream(sr); //TestObjClassSerializationMock.AssertCorrectContentsInt<TestObjClass>(objImpl); } }
public void FromStream_creates_correct_Object() { var typeMap = scope.Resolve<TypeMap>(); var ms = new MemoryStream(); var sw = new ZetboxStreamWriter(typeMap, new BinaryWriter(ms)); var sr = new ZetboxStreamReader(typeMap, new BinaryReader(ms)); TestObjClassSerializationMock.ToStream<TestObjClass, TestEnum>(sw, _iftFactory); sw.Flush(); Assert.That(ms.Length, Is.GreaterThan(0)); ms.Seek(0, SeekOrigin.Begin); var t = sr.ReadSerializableType(); Assert.That(t.GetSystemType().IsAssignableFrom(typeof(TestObjClass)), string.Format("{0} not assignable to {1}", typeof(TestObjClass), t)); var obj = new TestObjClassImpl(); obj.FromStream(sr); ctx.Attach(obj); TestObjClassSerializationMock.AssertCorrectContentsEnum<TestObjClass>(obj); }
public void FromStream_creates_correct_Object() { var typeMap = scope.Resolve <TypeMap>(); var ms = new MemoryStream(); var sw = new ZetboxStreamWriter(typeMap, new BinaryWriter(ms)); var sr = new ZetboxStreamReader(typeMap, new BinaryReader(ms)); TestObjClassSerializationMock.ToStream <TestObjClass, TestEnum>(sw, _iftFactory); sw.Flush(); Assert.That(ms.Length, Is.GreaterThan(0)); ms.Seek(0, SeekOrigin.Begin); var t = sr.ReadSerializableType(); Assert.That(t.GetSystemType().IsAssignableFrom(typeof(TestObjClass)), string.Format("{0} not assignable to {1}", typeof(TestObjClass), t)); var obj = new TestObjClassImpl(); obj.FromStream(sr); ctx.Attach(obj); TestObjClassSerializationMock.AssertCorrectContentsEnum <TestObjClass>(obj); }