public void StateBeforeFrame() { var ss = new StateSource { PaddingData = new byte[1000] }; var zw = new ZwinderStateManager(new ZwinderStateManagerSettings { CurrentBufferSize = 1, CurrentTargetFrameLength = 10000, RecentBufferSize = 1, RecentTargetFrameLength = 100000, AncientStateInterval = 50000 }, f => false); { var ms = new MemoryStream(); ss.SaveStateBinary(new BinaryWriter(ms)); zw.Engage(ms.ToArray()); } for (int frame = 0; frame <= 10440; frame++) { ss.Frame = frame; zw.Capture(frame, ss); } var kvp = zw.GetStateClosestToFrame(10440); var actual = StateSource.GetFrameNumberInState(kvp.Value); Assert.AreEqual(kvp.Key, actual); Assert.IsTrue(actual <= 10440); }
private ZwinderStateManager CreateSmallZwinder(IStatable ss) { var zw = new ZwinderStateManager(new ZwinderStateManagerSettings { CurrentBufferSize = 1, CurrentTargetFrameLength = 10000, RecentBufferSize = 1, RecentTargetFrameLength = 100000, AncientStateInterval = 50000 }, f => false); var ms = new MemoryStream(); ss.SaveStateBinary(new BinaryWriter(ms)); zw.Engage(ms.ToArray()); return(zw); }