示例#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]);
        }
示例#2
0
        public void TestCorrelationCoreAddOperationAndVerify()
        {
            CorrelationContext cc = new CorrelationContext(RootValue);

            long op1 = cc.AddOperation(SecondOperationId);
            long op2 = cc.AddOperation(ThirdOperationId);
            long op3 = cc.AddOperation(2342384793843948343L);

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

            string correlationContext = cc.Get();

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

            // Assert.AreEqual("OQUAAAAAAAA=", parts[0]); always random
            Assert.AreEqual("AwAAAAAAAAA=", parts[1]);
            Assert.AreEqual("aLmSyOPYAAA=", parts[2]);
            Assert.AreEqual("N1tYPI/SgSA=", parts[3]);
        }