Exemplo n.º 1
0
        public void CloneCreateSnapshot()
        {
            // Setup
            CoreAction action = CoreAction.CreateSnapshot(100, 42);

            // Act
            CoreAction clone = action.Clone();

            // Verify
            Assert.AreEqual(CoreRequest.Types.CreateSnapshot, clone.Type);
            Assert.AreEqual(100, clone.Ticks);
            Assert.AreEqual(42, clone.SnapshotId);
        }
Exemplo n.º 2
0
        public void ReceiveLoadSnapshot()
        {
            // Setup
            using (RemoteMachine machine = new RemoteMachine(_mockRemote.Object))
            {
                TestHelpers.ProcessRemoteRequest(machine, _receiveCoreAction, CoreAction.RunUntil(0, 100000, null));
                TestHelpers.ProcessRemoteRequest(machine, _receiveCoreAction, CoreAction.CreateSnapshot(0, 0));
                UInt64 saveSnapshotTicks = machine.Ticks;

                TestHelpers.ProcessRemoteRequest(machine, _receiveCoreAction, CoreAction.RunUntil(0, 200000, null));
                UInt64 preLoadSnapshotTicks = machine.Ticks;

                // Act
                TestHelpers.ProcessRemoteRequest(machine, _receiveCoreAction, CoreAction.RevertToSnapshot(0, 0));
                UInt64 loadSnapshotTicks = machine.Ticks;

                // Verify
                Assert.AreNotEqual(preLoadSnapshotTicks, loadSnapshotTicks);
                Assert.AreEqual(loadSnapshotTicks, saveSnapshotTicks);
            }
        }