public void given_it_is_the_first_time_through_should_call_append_on_proxied_appender() { var appender = new StubbingAppender(); var sut = new CountAppenderProxy(appender,5); 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 CountAppenderProxy(appender, 5); 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 CountAppenderProxy(appender, 5); 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 CountAppenderProxy(appender, 5); 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 CountAppenderProxy(appender, 5); 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 CountAppenderProxy(appender, 5); 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 CountAppenderProxy( MockRepository.GenerateStub<IAppender>(), 5); }
public void given_third_time_through_error_occurred_but_count_has_been_reached_should_append() { var appender = new StubbingAppender(); var sut = new CountAppenderProxy(appender, 2); appender.SingleEventAppendAction = (x) => appender.SetError("foo"); sut.TryAppend(new LoggingEvent( new LoggingEventData())); sut.TryAppend(new LoggingEvent( new LoggingEventData())); appender.SingleEventAppendAction = (x) => { }; var result = sut.TryAppend(new LoggingEvent( new LoggingEventData())); Assert.That(appender.AppendCalledCounter, Iz.EqualTo(2)); Assert.That(result, Iz.True); }