本文整理汇总了C#中Mock.AddLocalFile方法的典型用法代码示例。如果您正苦于以下问题:C# Mock.AddLocalFile方法的具体用法?C# Mock.AddLocalFile怎么用?C# Mock.AddLocalFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mock
的用法示例。
在下文中一共展示了Mock.AddLocalFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoNotFetchIfExtendedAttributeIsMissing
public void DoNotFetchIfExtendedAttributeIsMissing() {
var session = new Mock<ISession>();
session.SetupSessionDefaultValues();
IDocument remote = MockOfIDocumentUtil.CreateRemoteDocumentMock(null, Id, "name", (string)null).Object;
session.Setup(s => s.GetObject(Id, It.IsAny<IOperationContext>())).Returns(remote);
var storage = new Mock<IMetaDataStorage>();
storage.AddLocalFile(Path, Id, Uuid);
var fileEvent = new FileEvent(Mock.Of<IFileInfo>());
var fetcher = new RemoteObjectFetcher(session.Object, storage.Object);
fetcher.Handle(fileEvent);
session.Verify(s => s.GetObject(It.IsAny<string>(), It.IsAny<IOperationContext>()), Times.Never());
}
示例2: FileEventForRemovedFile
public void FileEventForRemovedFile() {
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.AddLocalFile(Path, Id);
var fileInfoMock = new Mock<IFileInfo>();
fileInfoMock.Setup(f => f.GetExtendedAttribute(It.IsAny<string>())).Returns(Uuid.ToString());
var fileEvent = new FileEvent(fileInfoMock.Object);
var fetcher = new RemoteObjectFetcher(session.Object, storage.Object);
Assert.That(fetcher.Handle(fileEvent), Is.False);
Assert.That(fileEvent.RemoteFile, Is.Null);
}
示例3: FilterDeletesFsEventsIfLocalFileSystemContainsTheElementOfTheStorage
public void FilterDeletesFsEventsIfLocalFileSystemContainsTheElementOfTheStorage() {
string path = "path";
Guid guid = Guid.NewGuid();
var storage = new Mock<IMetaDataStorage>();
var fsFactory = new Mock<IFileSystemInfoFactory>();
fsFactory.AddFile(path, guid, true);
storage.AddLocalFile(path, "id", guid);
var filter = new IgnoreAlreadyHandledFsEventsFilter(storage.Object, fsFactory.Object);
var fsEvent = Mock.Of<IFSEvent>(
e =>
e.LocalPath == path &&
e.Type == WatcherChangeTypes.Deleted &&
e.IsDirectory== false);
Assert.That(filter.Handle(fsEvent), Is.True);
}
示例4: FileEventWithoutObjectId
public void FileEventWithoutObjectId() {
var session = new Mock<ISession>();
session.SetupSessionDefaultValues();
IDocument remote = MockOfIDocumentUtil.CreateRemoteDocumentMock(null, Id, "name", (string)null).Object;
session.Setup(s => s.GetObject(Id, It.IsAny<IOperationContext>())).Returns(remote);
var storage = new Mock<IMetaDataStorage>();
storage.AddLocalFile(Path, Id, Uuid);
var fileInfoMock = new Mock<IFileInfo>();
fileInfoMock.Setup(f => f.Uuid).Returns(Uuid);
fileInfoMock.Setup(f => f.Exists).Returns(true);
var fileEvent = new FileEvent(fileInfoMock.Object);
var fetcher = new RemoteObjectFetcher(session.Object, storage.Object);
Assert.That(fetcher.Handle(fileEvent), Is.False);
Assert.That(fileEvent.RemoteFile, Is.Not.Null);
}
示例5: RemoteDeletionChangeTest
public void RemoteDeletionChangeTest() {
var storage = new Mock<IMetaDataStorage>();
storage.AddLocalFile("path", Id);
FileEvent fileEvent = null;
var queue = new Mock<ISyncEventQueue>();
queue.Setup(h => h.AddEvent(It.IsAny<FileEvent>()))
.Callback<ISyncEvent>(e => fileEvent = e as FileEvent);
var transformer = new ContentChangeEventTransformer(queue.Object, storage.Object);
var contentChangeEvent = this.PrepareEvent(DotCMIS.Enums.ChangeType.Deleted, false);
Assert.That(transformer.Handle(contentChangeEvent), Is.True);
queue.Verify(q => q.AddEvent(It.IsAny<FileEvent>()), Times.Once());
Assert.That(fileEvent.Remote, Is.EqualTo(MetaDataChangeType.DELETED));
Assert.That(fileEvent.RemoteContent, Is.EqualTo(ContentChangeType.NONE));
}