本文整理汇总了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();
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}