本文整理汇总了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));
}
示例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));
}
示例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));
}
示例4: ConstructorThrowsExceptionIfSolverIsNull
public void ConstructorThrowsExceptionIfSolverIsNull() {
Mock<ISession> session = new Mock<ISession>();
session.SetupTypeSystem();
Assert.Throws<ArgumentNullException>(() => new LocalObjectRenamedRemoteObjectChanged(session.Object, Mock.Of<IMetaDataStorage>(), null));
}
示例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");
}
示例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);
}
示例7: ConstructorThrowsExceptionIfFiltersAreNull
public void ConstructorThrowsExceptionIfFiltersAreNull() {
var session = new Mock<ISession>();
session.SetupTypeSystem();
Assert.Throws<ArgumentNullException>(() => new RemoteObjectDeleted(session.Object, Mock.Of<IMetaDataStorage>(), null));
}
示例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));
}
示例9: DefaultConstructorTest
public void DefaultConstructorTest() {
var session = new Mock<ISession>();
session.SetupTypeSystem();
new RemoteObjectDeleted(session.Object, Mock.Of<IMetaDataStorage>(), Mock.Of<IFilterAggregator>());
}
示例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)));
}
示例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);
}
示例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);
}
示例13: DefaultConstructorTest
public void DefaultConstructorTest() {
var session = new Mock<ISession>();
session.SetupTypeSystem();
new RemoteObjectRenamed(session.Object, Mock.Of<IMetaDataStorage>());
}
示例14: ConstructorTakesSessionAndStorageAndDateSyncDisabled
public void ConstructorTakesSessionAndStorageAndDateSyncDisabled() {
var session = new Mock<ISession>();
session.SetupTypeSystem();
new LocalObjectChangedRemoteObjectChanged(session.Object, Mock.Of<IMetaDataStorage>(), null, new TransmissionManager());
}
示例15: ConstructorThrowsExceptionIfTransmissionManagerIsNull
public void ConstructorThrowsExceptionIfTransmissionManagerIsNull() {
var session = new Mock<ISession>();
session.SetupTypeSystem();
Assert.Throws<ArgumentNullException>(() => new LocalObjectChanged(session.Object, Mock.Of<IMetaDataStorage>(), null, null));
}