public void NullCategoryTest() { CategoryTraceListener categoryTraceListener = new CategoryTraceListener(); Debug.Listeners.Add(categoryTraceListener); ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString()); DebugAppender debugAppender = new DebugAppender(); debugAppender.Layout = new SimpleLayout(); debugAppender.ActivateOptions(); debugAppender.Category = null; TestErrorHandler testErrHandler = new TestErrorHandler(); debugAppender.ErrorHandler = testErrHandler; BasicConfigurator.Configure(rep, debugAppender); ILog log = LogManager.GetLogger(rep.Name, GetType()); log.Debug("Message"); Assert.AreEqual( null, categoryTraceListener.Category); Assert.IsFalse(testErrHandler.ErrorOccured); Debug.Listeners.Remove(categoryTraceListener); }
public void DapperReaderNode_raises_error_and_signals_end_with_bad_query() { using (var con = new SQLiteConnection("Data Source=:memory:;Version=3;New=True;")) { con.Open(); var context = new EtlPipelineContext(); var emitter = new TestEmitter <TestTable>(); var errorHandler = new TestErrorHandler(); var node = new DapperReaderNode <TestTable>(() => con, "select Id, Timestamp, Name from TestTable;"); node.SetEmitter(emitter).SetErrorHandler(errorHandler); node.Execute(context); errorHandler.Errors.Should().HaveCount(1); emitter.HasSignalledEnd.Should().BeTrue(); } }
public void AbstractSourceNode_calls_SignalEnd_when_general_error() { var exception = new Exception("This is a test exception."); var context = new EtlPipelineContext(); var errorHandler = new TestErrorHandler(); var emitter = new TestEmitter <Row>(); var node = new TestAbstractSourceNode <Row>((ctx, e) => { e.Emit(new Row()); throw exception; }); node.SetErrorHandler(errorHandler); node.SetEmitter(emitter); node.Execute(context); errorHandler.Errors.Count.Should().Be(1); errorHandler.Errors.First().Node.Should().Be(node); errorHandler.Errors.First().Exception.Should().Be(exception); emitter.HasSignalledEnd.Should().BeTrue(); }