コード例 #1
0
        public void TestModelSerialisationIntegrityUnbalanced()
        {
            var oldModel  = GetNetwork("unbalanced");
            var oldStream = new MemoryStream();

            oldModel.Serialise(oldStream);
            oldStream.Seek(0, SeekOrigin.Begin);
            NetworkModel model = (NetworkModel)QuickSerialisers.Deserialise(oldStream);

            ModelIntegrityAssertionsUnbalanced(model);
        }
コード例 #2
0
        public void TestSerialisation()
        {
            var oldModel  = GetNetwork();
            var oldStream = new MemoryStream();

            oldModel.Serialise(oldStream);
            oldStream.Seek(0, SeekOrigin.Begin);
            NetworkModel model     = (NetworkModel)QuickSerialisers.Deserialise(oldStream);
            var          newStream = new MemoryStream();

            model.Serialise(newStream);
            Assert.IsTrue(newStream.ToArray().SequenceEqual(oldStream.ToArray()));
        }