public void ProjectThrowsForNonScheduledEventExceptionTypes(Type exceptionType, bool expectThrow) { var exception = CreateExceptionFromType(exceptionType); var interpreter = new ScheduledEventExceptionInterpreter(); var constraint = expectThrow ? (IResolveConstraint)Throws.Exception : Throws.Nothing; Assert.That(() => interpreter.Interpret(exception, NullExceptionInterpreter.Instance), constraint); }
public void InvokesInnerExceptionProjectionOnInnerException() { var inner = new Exception("inner"); var exception = new ScheduledEventException("name", "message", inner); var mockInnerInterpreter = new Mock <IExceptionInterpreter>(); mockInnerInterpreter.Setup(iep => iep.Interpret(inner, mockInnerInterpreter.Object)) .Returns(new Exception("Projected " + inner.Message)) .Verifiable(); var interpreter = new ScheduledEventExceptionInterpreter(); interpreter.Interpret(exception, mockInnerInterpreter.Object); mockInnerInterpreter.Verify(iep => iep.Interpret(inner, mockInnerInterpreter.Object), Times.Exactly(1)); }