コード例 #1
0
 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));
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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));
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 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));
 }
コード例 #6
0
 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)));
 }
コード例 #7
0
 public void given_appender_to_proxy_does_not_inherit_from_appender_skeleton_should_throw()
 {
     var sut = new CountAppenderProxy(
                 MockRepository.GenerateStub<IAppender>(), 5);
 }
コード例 #8
0
 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);
 }