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


C# Mock.AddLocalFile方法代码示例

本文整理汇总了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());
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:15,代码来源:RemoteObjectFetcherTest.cs

示例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);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:16,代码来源:RemoteObjectFetcherTest.cs

示例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);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:16,代码来源:IgnoreAlreadyHandledFsEventsFilterTest.cs

示例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);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:18,代码来源:RemoteObjectFetcherTest.cs

示例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));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:16,代码来源:ContentChangeEventTransformerTest.cs


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