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


C# Mock.SetupTypeSystem方法代码示例

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


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

示例1: ConstructorSetsServerPropertyCorrectly

        public void ConstructorSetsServerPropertyCorrectly([Values(true, false)]bool serverCanModifyLastModificationDate) {
            var session = new Mock<ISession>();
            session.SetupTypeSystem(serverCanModifyLastModificationDate);
            var underTest = new SolverClass(session.Object, Mock.Of<IMetaDataStorage>());

            Assert.That(underTest.GetModification(), Is.EqualTo(serverCanModifyLastModificationDate));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:7,代码来源:AbstractEnhancedSolverTest.cs

示例2: EnsureLegalCharactersThrowsExceptionIfFilenameContainsUtf8Character

        public void EnsureLegalCharactersThrowsExceptionIfFilenameContainsUtf8Character() {
            var session = new Mock<ISession>();
            session.SetupTypeSystem();
            var underTest = new SolverClass(session.Object, Mock.Of<IMetaDataStorage>());
            var exception = new CmisConstraintException();
            var fileInfo = Mock.Of<IFileSystemInfo>(f => f.Name == @"ä" && f.FullName == @"ä");

            Assert.Throws<InteractionNeededException>(() => underTest.CallEnsureThatLocalFileNameContainsLegalCharacters(fileInfo, exception));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:9,代码来源:AbstractEnhancedSolverTest.cs

示例3: ConstructorSetsPropertiesCorrectly

        public void ConstructorSetsPropertiesCorrectly([Values(true, false)]bool withGivenTransmissionStorage) {
            var session = new Mock<ISession>();
            session.SetupTypeSystem();
            var storage = Mock.Of<IMetaDataStorage>();
            var transmissionStorage = withGivenTransmissionStorage ? Mock.Of<IFileTransmissionStorage>() : null;
            var underTest = new SolverClass(session.Object, storage, transmissionStorage);

            Assert.That(underTest.GetSession(), Is.EqualTo(session.Object));
            Assert.That(underTest.GetStorage(), Is.EqualTo(storage));
            Assert.That(underTest.GetTransmissionStorage(), Is.EqualTo(transmissionStorage));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:11,代码来源:AbstractEnhancedSolverTest.cs

示例4: ConstructorThrowsExceptionIfSolverIsNull

 public void ConstructorThrowsExceptionIfSolverIsNull() {
     Mock<ISession> session = new Mock<ISession>();
     session.SetupTypeSystem();
     Assert.Throws<ArgumentNullException>(() => new LocalObjectRenamedRemoteObjectChanged(session.Object, Mock.Of<IMetaDataStorage>(), null));
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:5,代码来源:LocalObjectRenamedRemoteObjectChangedTest.cs

示例5: UploadFileClosesTransmissionOnIOException

        public void UploadFileClosesTransmissionOnIOException() {
            var session = new Mock<ISession>();
            session.SetupTypeSystem();

            var underTest = new SolverClass(session.Object, Mock.Of<IMetaDataStorage>());

            underTest.Upload(null, null, null);
            Assert.Fail("TODO");
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:9,代码来源:AbstractEnhancedSolverTest.cs

示例6: EnsureLegalCharactersIfFilenameIsValid

        public void EnsureLegalCharactersIfFilenameIsValid() {
            var session = new Mock<ISession>();
            session.SetupTypeSystem();
            var underTest = new SolverClass(session.Object, Mock.Of<IMetaDataStorage>());
            var exception = new CmisConstraintException();
            var fileInfo = Mock.Of<IFileSystemInfo>(f => f.Name == "foo");

            underTest.CallEnsureThatLocalFileNameContainsLegalCharacters(fileInfo, exception);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:9,代码来源:AbstractEnhancedSolverTest.cs

示例7: ConstructorThrowsExceptionIfFiltersAreNull

 public void ConstructorThrowsExceptionIfFiltersAreNull() {
     var session = new Mock<ISession>();
     session.SetupTypeSystem();
     Assert.Throws<ArgumentNullException>(() => new RemoteObjectDeleted(session.Object, Mock.Of<IMetaDataStorage>(), null));
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:5,代码来源:RemoteObjectDeletedTest.cs

示例8: RunFakeEvent

 public void RunFakeEvent() {
     var session = new Mock<ISession>();
     session.SetupTypeSystem();
     var observer = new ObservableHandler();
     var storage = this.GetInitializedStorage();
     var queue = this.CreateQueue(session, storage, observer);
     var myEvent = new Mock<ISyncEvent>();
     queue.AddEvent(myEvent.Object);
     queue.Run();
     Assert.That(observer.List.Count, Is.EqualTo(1));
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:11,代码来源:AllHandlersIT.cs

示例9: DefaultConstructorTest

 public void DefaultConstructorTest() {
     var session = new Mock<ISession>();
     session.SetupTypeSystem();
     new RemoteObjectDeleted(session.Object, Mock.Of<IMetaDataStorage>(), Mock.Of<IFilterAggregator>());
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:5,代码来源:RemoteObjectDeletedTest.cs

示例10: RunStartNewSyncEvent

 public void RunStartNewSyncEvent() {
     string rootFolderName = "/";
     string rootFolderId = "root";
     var storage = this.GetInitializedStorage();
     storage.SaveMappedObject(new MappedObject(rootFolderName, rootFolderId, MappedObjectType.Folder, null, "oldtoken"));
     var session = new Mock<ISession>();
     session.SetupSessionDefaultValues();
     session.SetupChangeLogToken("default");
     session.SetupTypeSystem();
     var observer = new ObservableHandler();
     var queue = this.CreateQueue(session, storage, observer);
     queue.RunStartSyncEvent();
     Assert.That(observer.List.Count, Is.EqualTo(1));
     Assert.That(observer.List[0], Is.TypeOf(typeof(FullSyncCompletedEvent)));
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:15,代码来源:AllHandlersIT.cs

示例11: RunFSEventFolderDeleted

        public void RunFSEventFolderDeleted() {
            var storage = this.GetInitializedStorage();
            var path = new Mock<IFileInfo>();
            var name = "a";
            path.Setup(p => p.FullName).Returns(Path.Combine(this.localRoot, name));
            string id = "id";

            var mappedObject = new MappedObject(name, id, MappedObjectType.Folder, null, "changeToken");
            storage.SaveMappedObject(mappedObject);

            var session = new Mock<ISession>();
            session.SetupSessionDefaultValues();
            session.SetupChangeLogToken("default");
            session.SetupTypeSystem();
            IFolder remote = MockOfIFolderUtil.CreateRemoteFolderMock(id, name, (string)null, changetoken: "changeToken").Object;
            session.Setup(s => s.GetObject(id, It.IsAny<IOperationContext>())).Returns(remote);
            var myEvent = new FSEvent(WatcherChangeTypes.Deleted, path.Object.FullName, true);
            var queue = this.CreateQueue(session, storage);
            queue.AddEvent(myEvent);
            queue.Run();

            Mock.Get(remote).Verify(d => d.DeleteTree(false, UnfileObject.DeleteSinglefiled, true), Times.Once());
            Assert.That(storage.GetObjectByRemoteId(id), Is.Null);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:24,代码来源:AllHandlersIT.cs

示例12: CreateNewSessionEvent

        private static SuccessfulLoginEvent CreateNewSessionEvent(bool changeEventSupported, bool supportsSelectiveIgnore = true, string id = "i", string token = "t") {
            var session = new Mock<ISession>();
            var remoteObject = new Mock<IFolder>();
            remoteObject.Setup(r => r.Id).Returns(id);
            remoteObject.Setup(r => r.ChangeToken).Returns(token);
            remoteObject.Setup(r => r.Path).Returns("path");
            session.SetupTypeSystem(true, supportsSelectiveIgnore);
            session.Setup(s => s.GetObjectByPath(It.IsAny<string>())).Returns(remoteObject.Object);
            if (changeEventSupported) {
                session.Setup(s => s.RepositoryInfo.Capabilities.ChangesCapability).Returns(CapabilityChanges.All);
            }

            return new SuccessfulLoginEvent(new Uri("http://example.com"), session.Object);
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:14,代码来源:EventManagerInitializerTest.cs

示例13: DefaultConstructorTest

 public void DefaultConstructorTest() {
     var session = new Mock<ISession>();
     session.SetupTypeSystem();
     new RemoteObjectRenamed(session.Object, Mock.Of<IMetaDataStorage>());
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:5,代码来源:RemoteObjectRenamedTest.cs

示例14: ConstructorTakesSessionAndStorageAndDateSyncDisabled

 public void ConstructorTakesSessionAndStorageAndDateSyncDisabled() {
     var session = new Mock<ISession>();
     session.SetupTypeSystem();
     new LocalObjectChangedRemoteObjectChanged(session.Object, Mock.Of<IMetaDataStorage>(), null, new TransmissionManager());
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:5,代码来源:LocalObjectChangedRemoteObjectChangedTest.cs

示例15: ConstructorThrowsExceptionIfTransmissionManagerIsNull

 public void ConstructorThrowsExceptionIfTransmissionManagerIsNull() {
     var session = new Mock<ISession>();
     session.SetupTypeSystem();
     Assert.Throws<ArgumentNullException>(() => new LocalObjectChanged(session.Object, Mock.Of<IMetaDataStorage>(), null, null));
 }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:5,代码来源:LocalObjectChangedTest.cs


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