public void given_it_is_the_first_time_through_should_call_append_on_proxied_appender() { var appender = new StubbingAppender(); var sut = new IndefiniteAppenderProxy(appender); sut.TryAppend(new LoggingEvent( new LoggingEventData())); Assert.That(appender.AppendCalledCounter, Iz.EqualTo(1)); }
public void given_it_is_first_time_through_and_error_raised_should_return_false() { var appender = new StubbingAppender(); var sut = new IndefiniteAppenderProxy(appender); appender.SingleEventAppendAction = (x) => appender.SetError("foo"); var result = sut.TryAppend(new LoggingEvent( new LoggingEventData())); Assert.That(result, Iz.False); }
public void given_second_time_through_and_appender_has_no_error_should_append() { var appender = new StubbingAppender(); var sut = new IndefiniteAppenderProxy(appender); sut.TryAppend(new LoggingEvent( new LoggingEventData())); sut.TryAppend(new LoggingEvent( new LoggingEventData())); Assert.That(appender.AppendCalledCounter, Iz.EqualTo(2)); }
public void given_second_time_through_and_appender_has_error_should_return_not_succeeded() { var appender = new StubbingAppender(); var sut = new IndefiniteAppenderProxy(appender); appender.SingleEventAppendAction = (x) => appender.SetError("foo"); sut.TryAppend(new LoggingEvent( new LoggingEventData())); var result = sut.TryAppend(new LoggingEvent( new LoggingEventData())); Assert.That(result, Iz.False); }
public void given_second_time_through_and_appender_has_error_should_not_append() { var appender = new StubbingAppender(); var sut = new IndefiniteAppenderProxy(appender); appender.SingleEventAppendAction = (x) => appender.SetError("foo"); sut.TryAppend(new LoggingEvent( new LoggingEventData())); sut.TryAppend(new LoggingEvent( new LoggingEventData())); Assert.That(appender.AppendCalledCounter, Iz.EqualTo(1)); }
public void should_set_recording_error_handler_on_appender() { var appender = new StubbingAppender(); var sut = new IndefiniteAppenderProxy(appender); Assert.That(appender.ErrorHandler, Iz.InstanceOfType(typeof(RecordingErrorHandler))); }
public void given_appender_to_proxy_does_not_inherit_from_appender_skeleton_should_throw() { var sut = new IndefiniteAppenderProxy( MockRepository.GenerateStub<IAppender>()); }