public void should_log_if_item_is_null() { // Arrange var args = new ProcessIntegrationItemArgs { IntegrationItemID = ID.NewID, SynchContext = this.CreateSynchContext() }; // Act var logWatcher = new LogWatcher(() => this.processor.Process(args)); // Assert logWatcher.Ensure() .LevelIs(LogNotificationLevel.Warning) .MessageIs( "Can't get item '{0}' from database '{1}'".FormatWith(args.IntegrationItemID, args.SynchContext.Database)); }
public void should_log_if_sync_pipeline_throws() { // Arrange var exc = new Exception("Pipeline is not work"); using (new PipelinesHandler().ThrowInPipeline(PipelineNames.SynchronizeTree, exc)) { var synchContext = new SynchContext(new ItemMock().AsConfigurationItem()); // Act var logWatcher = new LogWatcher(() => IntegrationPipelinesRunner.SynchronizeTree(ProcessIntegrationItemsOptions.DefaultOptions, synchContext)); // Assert logWatcher.Ensure() .LevelIs(LogNotificationLevel.Error) .MessageIs(string.Format("Sharepoint Provider can't process tree.{2}Integration config item ID: {0}, {1}", synchContext.ParentID, "Web: server List: list", Environment.NewLine)) .ExceptionIs(exc); } }
public void should_correct_log_soap_exception() { // Arrange var document = new XmlDocument(); document.LoadXml("<details>DetailsInfo</details>"); var exc = new SoapException("Pipeline is not work", new XmlQualifiedName(), "actor", document.ChildNodes[0]); using (new PipelinesHandler().ThrowInPipeline(PipelineNames.SynchronizeTree, exc)) { var synchContext = new SynchContext(new ItemMock().AsConfigurationItem()); // Act var logWatcher = new LogWatcher(() => IntegrationPipelinesRunner.SynchronizeTree(ProcessIntegrationItemsOptions.DefaultOptions, synchContext)); // Assert logWatcher.Ensure() .Message.Should() .EndWith(string.Format("{1}{0}", exc.Detail.InnerText, Environment.NewLine)); } }