Example #1
0
        public void Discard_should_remove_obsolete_siblings()
        {
            var kernel = new DvvKernel();

            var s1 = new Siblings
            {
                { new JObject(new JProperty("v", 1)), "((r,1),{})" },
                { new JObject(new JProperty("v", 2)), "((r,2),{})" }
            };

            // This is the context we'd receive representing ((r,3),{(r,1)}) : v3
            var context = new VersionVector(new CausalEvent("r", 1));

            Siblings siblings = kernel.Discard(s1, context);

            // Assert
            siblings.Should().HaveCount(1);

            siblings.Should().NotContain(x => x.Clock.Equals(DottedVersionVector.Parse("((r,1),{})")));
            siblings.Should().Contain(x => x.Clock.Equals(DottedVersionVector.Parse("((r,2),{})")));
        }