public void SaveCreateRoundTrip()
        {
            var ms = new MemoryStream();
            var zw = new ZwinderStateManager(new ZwinderStateManagerSettings
            {
                CurrentBufferSize        = 16,
                CurrentTargetFrameLength = 10000,

                RecentBufferSize        = 16,
                RecentTargetFrameLength = 100000,

                AncientStateInterval = 50000
            }, f => false);

            zw.SaveStateHistory(new BinaryWriter(ms));
            var buff = ms.ToArray();
            var rms  = new MemoryStream(buff, false);

            var zw2 = ZwinderStateManager.Create(new BinaryReader(rms), zw.Settings, f => false);

            // TODO: we could assert more things here to be thorough
            Assert.IsNotNull(zw2);
            Assert.AreEqual(zw.Settings.CurrentBufferSize, zw2.Settings.CurrentBufferSize);
            Assert.AreEqual(zw.Settings.RecentBufferSize, zw2.Settings.RecentBufferSize);
        }
Exemple #2
0
        public void SaveCreateRoundTrip()
        {
            var ms = new MemoryStream();
            var zw = new ZwinderStateManager();

            zw.SaveStateHistory(new BinaryWriter(ms));
            var buff = ms.ToArray();
            var rms  = new MemoryStream(buff, false);

            var zw2 = ZwinderStateManager.Create(new BinaryReader(rms), new ZwinderStateManagerSettings());

            // TODO: we could assert more things here to be thorough
            Assert.IsNotNull(zw2);
            Assert.AreEqual(zw.Settings.CurrentBufferSize, zw2.Settings.CurrentBufferSize);
            Assert.AreEqual(zw.Settings.RecentBufferSize, zw2.Settings.RecentBufferSize);
        }