Beispiel #1
0
        public void TestPusherFindCommonAncestor()
        {
            var ids = new JArray();

            ids.Add("second");
            ids.Add("first");

            var revDict = new JObject();

            revDict["ids"]   = ids;
            revDict["start"] = 2;

            var properties = new Dictionary <string, object>();

            properties["_revisions"] = revDict;

            var rev = new RevisionInternal(properties, database);

            Assert.AreEqual(Pusher.FindCommonAncestor(rev, new  List <string>()), 0);
            Assert.AreEqual(Pusher.FindCommonAncestor(rev, (new [] { "3-noway", "1-nope" }).ToList()), 0);
            Assert.AreEqual(Pusher.FindCommonAncestor(rev, (new [] { "3-noway", "1-first" }).ToList()), 1);
            Assert.AreEqual(Pusher.FindCommonAncestor(rev, (new [] { "3-noway", "2-second", "1-first" }).ToList()), 2);
        }