public void describes_itself() { var handler = new RespondWithMessageHandler<Exception>(null); var description = new Description(); handler.Describe(description); description.Title.ShouldNotBeNull(); }
public void returns_no_continuation_when_exception_does_not_match() { var handler = new RespondWithMessageHandler<NotImplementedException>(null); handler.DetermineContinuation(null, new Exception()).ShouldBeNull(); handler.DetermineContinuation(null, new SystemException()).ShouldBeNull(); handler.DetermineContinuation(null, new NullReferenceException()).ShouldBeNull(); }
public void responds_with_message_when_the_exception_matches() { var message = new object(); var handler = new RespondWithMessageHandler<Exception>((ex, env) => message); handler.DetermineContinuation(null, new Exception()) .ShouldBeOfType<RespondWithMessageContinuation>() .Message.ShouldBeTheSameAs(message); }
public void returns_no_continuation_when_exception_does_not_match() { var handler = new RespondWithMessageHandler <NotImplementedException>(null); handler.DetermineContinuation(null, new Exception()).ShouldBeNull(); handler.DetermineContinuation(null, new SystemException()).ShouldBeNull(); handler.DetermineContinuation(null, new NullReferenceException()).ShouldBeNull(); }
public void describes_itself() { var handler = new RespondWithMessageHandler <Exception>(null); var description = new Description(); handler.Describe(description); description.Title.ShouldNotBeNull(); }
public void returns_no_continuation_when_exception_does_not_match() { var handler = new RespondWithMessageHandler <NotImplementedException>(null); ShouldBeNullExtensions.ShouldBeNull(handler.DetermineContinuation(null, new Exception())); ShouldBeNullExtensions.ShouldBeNull(handler.DetermineContinuation(null, new DivideByZeroException())); ShouldBeNullExtensions.ShouldBeNull(handler.DetermineContinuation(null, new NullReferenceException())); }
public ThenContinueExpression RespondWithMessage(Func <Exception, Envelope, object> messageFunc) { var handler = new RespondWithMessageHandler <T>(messageFunc); _parent.ErrorHandlers.Add(handler); return(this); }
public ThenContinueExpression RespondWithMessage(Func <Exception, Envelope, object> messageFunc) { var handler = new RespondWithMessageHandler <T>(messageFunc); _handler.Value.AddContinuation(handler); return(this); }
public void responds_with_message_when_the_exception_matches() { var message = new object(); var handler = new RespondWithMessageHandler <Exception>((ex, env) => message); handler.DetermineContinuation(null, new Exception()) .ShouldBeOfType <RespondWithMessageContinuation>() .Message.ShouldBeTheSameAs(message); }