Esempio n. 1
0
        public static Mock <ISession> GetSessionMockReturning3Changesin2Batches(DotCMIS.Enums.ChangeType type = DotCMIS.Enums.ChangeType.Updated, bool overlapping = false)
        {
            var changeEvents = new Mock <IChangeEvents>();

            changeEvents.Setup(ce => ce.HasMoreItems).ReturnsInOrder((bool?)true, (bool?)false);
            changeEvents.Setup(ce => ce.LatestChangeLogToken).ReturnsInOrder("A", "B");
            changeEvents.Setup(ce => ce.TotalNumItems).ReturnsInOrder(3, overlapping ? 2 : 1);
            var event1 = MockSessionUtil.GenerateChangeEvent(type, "one");
            var event2 = MockSessionUtil.GenerateChangeEvent(type, "two");
            var event3 = MockSessionUtil.GenerateChangeEvent(type, "three");
            List <IChangeEvent> changeList1 = new List <IChangeEvent>();

            changeList1.Add(event1.Object);
            changeList1.Add(event2.Object);
            List <IChangeEvent> changeList2 = new List <IChangeEvent>();

            if (overlapping)
            {
                changeList2.Add(event2.Object);
            }

            changeList2.Add(event3.Object);
            changeEvents.Setup(ce => ce.ChangeEventList).ReturnsInOrder(changeList1, changeList2);

            var session = new Mock <ISession>();

            session.SetupSessionDefaultValues();
            session.Setup(s => s.Binding.GetRepositoryService().GetRepositoryInfo(It.IsAny <string>(), null).LatestChangeLogToken).Returns("token");
            session.Setup(s => s.GetContentChanges(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <long>())).Returns(changeEvents.Object);

            return(session);
        }
Esempio n. 2
0
        public static Mock <ISession> GetSessionMockReturningDocumentChange(DotCMIS.Enums.ChangeType type, string id, string documentContentStreamId = null)
        {
            var session = MockSessionUtil.PrepareSessionMockForSingleChange(type, id);

            var newRemoteObject = MockOfIDocumentUtil.CreateRemoteDocumentMock(documentContentStreamId, id, "name", (string)null);

            session.Setup(s => s.GetObject(id, It.IsAny <IOperationContext>())).Returns(newRemoteObject.Object);
            session.Setup(s => s.GetObject(id)).Returns(newRemoteObject.Object);

            return(session);
        }