public void given_it_is_the_first_time_through_should_call_append_on_proxied_appender()
 {
     var appender = new StubbingAppender();
     var sut = new TimeAppenderProxy(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 TimeAppenderProxy(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 TimeAppenderProxy(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 TimeAppenderProxy(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 TimeAppenderProxy(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 TimeAppenderProxy(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 TimeAppenderProxy(
                 MockRepository.GenerateStub<IAppender>(), 5);
 }
 public void given_second_time_through_error_occurred_but_timeout_has_been_reached_should_append()
 {
     SystemDateTime.Now = () => new DateTime(2009, 1, 1, 10, 0, 0);
     var appender = new StubbingAppender();
     var sut = new TimeAppenderProxy(appender, 5);
     appender.MultipleEventAppendAction = (x) => appender.SetError("foo");
     sut.TryAppend(loggingEvents);
     SystemDateTime.Now = () => new DateTime(2009, 1, 1, 10, 6, 0);
     appender.MultipleEventAppendAction = (x) => { };
     var result = sut.TryAppend(loggingEvents);
     Assert.That(appender.AppendCalledCounter, Iz.EqualTo(2));
     Assert.That(result, Iz.True);
 }