当前位置: 首页>>代码示例>>C#>>正文


C# Mock.AddLocalFolder方法代码示例

本文整理汇总了C#中Mock.AddLocalFolder方法的典型用法代码示例。如果您正苦于以下问题:C# Mock.AddLocalFolder方法的具体用法?C# Mock.AddLocalFolder怎么用?C# Mock.AddLocalFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mock的用法示例。


在下文中一共展示了Mock.AddLocalFolder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OperationContextDoesNotUsesTheSessionCache

        public void OperationContextDoesNotUsesTheSessionCache() {
            var session = new Mock<ISession>();
            session.SetupSessionDefaultValues();
            IFolder remote = MockOfIFolderUtil.CreateRemoteFolderMock(Id, "name", "/name").Object;
            session.Setup(s => s.GetObject(Id, It.IsAny<IOperationContext>())).Returns(remote);

            var storage = new Mock<IMetaDataStorage>();
            storage.AddLocalFolder(Path, Id, Uuid);

            var dirMock = new Mock<IDirectoryInfo>();
            dirMock.Setup(d => d.Exists).Returns(true);
            dirMock.Setup(d => d.GetExtendedAttribute(MappedObject.ExtendedAttributeKey)).Returns(Uuid.ToString());
            var folderEvent = new FolderEvent(dirMock.Object);
            var fetcher = new RemoteObjectFetcher(session.Object, storage.Object);

            Assert.That(fetcher.Handle(folderEvent), Is.False);
            session.VerifyThatCachingIsDisabled();
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:18,代码来源:RemoteObjectFetcherTest.cs

示例2: CrawlRequestedEventWithNewRemoteFolder

        public void CrawlRequestedEventWithNewRemoteFolder() {
            var session = new Mock<ISession>();
            session.SetupSessionDefaultValues();
            IFolder remote = MockOfIFolderUtil.CreateRemoteFolderMock(Id, "name", "/name").Object;
            session.Setup(s => s.GetObject(Id, It.IsAny<IOperationContext>())).Returns(remote);

            var storage = new Mock<IMetaDataStorage>();
            storage.AddLocalFolder(Path, Id, Uuid);

            var dirMock = new Mock<IDirectoryInfo>();
            dirMock.Setup(d => d.Exists).Returns(true);
            dirMock.Setup(d => d.Uuid).Returns(Uuid);
            var crawlEvent = new CrawlRequestEvent(localFolder: dirMock.Object, remoteFolder: null);

            var fetcher = new RemoteObjectFetcher(session.Object, storage.Object);
            Assert.That(fetcher.Handle(crawlEvent), Is.False);
            Assert.That(crawlEvent.RemoteFolder, Is.EqualTo(remote));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:18,代码来源:RemoteObjectFetcherTest.cs

示例3: FolderEventWithoutObjectIdAndExtendedAttributeExceptionOnUuidRequest

        public void FolderEventWithoutObjectIdAndExtendedAttributeExceptionOnUuidRequest() {
            var session = new Mock<ISession>();
            session.SetupSessionDefaultValues();
            IFolder remote = MockOfIFolderUtil.CreateRemoteFolderMock(Id, "name", "/name").Object;
            session.Setup(s => s.GetObject(Id, It.IsAny<IOperationContext>())).Returns(remote);

            var storage = new Mock<IMetaDataStorage>();
            storage.AddLocalFolder(Path, Id, Uuid);

            var dirMock = new Mock<IDirectoryInfo>();
            dirMock.Setup(d => d.Exists).Returns(true);
            dirMock.Setup(d => d.Uuid).Throws<ExtendedAttributeException>();

            var folderEvent = new FolderEvent(dirMock.Object);
            var fetcher = new RemoteObjectFetcher(session.Object, storage.Object);

            Assert.That(fetcher.Handle(folderEvent), Is.False);
            Assert.That(folderEvent.RemoteFolder, Is.Null);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:19,代码来源:RemoteObjectFetcherTest.cs

示例4: FolderEventForRemovedFolder

        public void FolderEventForRemovedFolder() {
            var session = new Mock<ISession>();
            session.SetupSessionDefaultValues();
            session.Setup(s => s.GetObject(Id, It.IsAny<IOperationContext>())).Throws(new CmisObjectNotFoundException());

            var storage = new Mock<IMetaDataStorage>();
            storage.AddLocalFolder(Path, Id);

            var dirMock = new Mock<IDirectoryInfo>();
            dirMock.Setup(d => d.GetExtendedAttribute(MappedObject.ExtendedAttributeKey)).Returns(Uuid.ToString());

            var folderEvent = new FolderEvent(dirMock.Object);

            var fetcher = new RemoteObjectFetcher(session.Object, storage.Object);
            Assert.That(fetcher.Handle(folderEvent), Is.False);
            Assert.That(folderEvent.RemoteFolder, Is.Null);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:17,代码来源:RemoteObjectFetcherTest.cs

示例5: RemoteFolderSecurity

        public void RemoteFolderSecurity() {
            var storage = new Mock<IMetaDataStorage>();
            storage.AddLocalFolder("path", Id);
            FolderEvent folderEvent = null;
            var queue = new Mock<ISyncEventQueue>();
            queue.Setup(h => h.AddEvent(It.IsAny<FolderEvent>()))
                    .Callback<ISyncEvent>(e => folderEvent = e as FolderEvent);

            var transformer = new ContentChangeEventTransformer(queue.Object, storage.Object);
            var contentChangeEvent = this.PrepareFolderEvent(DotCMIS.Enums.ChangeType.Security);

            Assert.That(transformer.Handle(contentChangeEvent), Is.True);
            queue.Verify(q => q.AddEvent(It.IsAny<FolderEvent>()), Times.Once());
            Assert.That(folderEvent.Remote, Is.EqualTo(MetaDataChangeType.CHANGED));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:15,代码来源:ContentChangeEventTransformerTest.cs


注:本文中的Mock.AddLocalFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。