Esempio n. 1
0
        public void TestCorrelationCoreAddOperationAndVerify_RNG_Remove()
        {
            CorrelationContext cc = new CorrelationContext(1337);

            long op1 = cc.AddOperation();
            long op2 = cc.AddOperation();
            long op3 = cc.AddOperation();
            long op4 = cc.AddOperation();

            Assert.AreEqual(5, cc.CurrentOperationPosition.Position);

            long removed = cc.RemoveOperation();

            Assert.AreEqual(op4, removed);

            Assert.AreEqual(4, cc.CurrentOperationPosition.Position);

            string correlationContext = cc.Get();

            string[] parts = correlationContext.Split('|');

            // Assert.AreEqual(Convert.ToBase64String(BitConverter.GetBytes(RootValue)), parts[0]); always random
            Assert.AreEqual(Convert.ToBase64String(BitConverter.GetBytes(op1)), parts[1]);
            Assert.AreEqual(Convert.ToBase64String(BitConverter.GetBytes(op2)), parts[2]);
            Assert.AreEqual(Convert.ToBase64String(BitConverter.GetBytes(op3)), parts[3]);
        }