public void ThrowExceptionOnCmisConnectionExceptionOccurence() { var localDetection = new Mock<ISituationDetection<AbstractFolderEvent>>(); var remoteDetection = new Mock<ISituationDetection<AbstractFolderEvent>>(); int numberOfSolver = Enum.GetNames(typeof(SituationType)).Length; ISolver[,] solver = new ISolver[numberOfSolver, numberOfSolver]; var interactionNeededProducer = new Mock<ISolver>(); var exception = new CmisConnectionException("reason"); interactionNeededProducer.Setup( r => r.Solve( It.IsAny<IFileSystemInfo>(), It.IsAny<IObjectId>(), It.IsAny<ContentChangeType>(), It.IsAny<ContentChangeType>())).Throws(exception); solver[(int)SituationType.NOCHANGE, (int)SituationType.NOCHANGE] = interactionNeededProducer.Object; var mechanism = this.CreateMechanism(localDetection.Object, remoteDetection.Object, solver); localDetection.Setup(d => d.Analyse(this.storage.Object, It.IsAny<AbstractFolderEvent>())).Returns(SituationType.NOCHANGE); remoteDetection.Setup(d => d.Analyse(this.storage.Object, It.IsAny<AbstractFolderEvent>())).Returns(SituationType.NOCHANGE); var folderEvent = new FolderEvent(Mock.Of<IDirectoryInfo>(), Mock.Of<IFolder>()) { Local = MetaDataChangeType.NONE, Remote = MetaDataChangeType.NONE }; Assert.Throws<CmisConnectionException>(() => mechanism.Handle(folderEvent)); this.queue.VerifyThatNoEventIsAdded(); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Events.CmisConnectionExceptionEvent"/> class. /// The OccuredAt property will be set automatically to the actual time when the constructor is called. /// </summary> /// <param name="connectionException">Connection exception.</param> public CmisConnectionExceptionEvent(CmisConnectionException connectionException) : base(connectionException) { this.OccuredAt = DateTime.Now; }