public void WrapsScheduledEventExceptionInnerException()
        {
            var inner       = new Exception();
            var exception   = new ScheduledEventException("name", "message", inner);
            var interpreted = new ScheduledEventExceptionInterpreter().Interpret(exception, NullExceptionInterpreter.Instance);

            Assert.AreEqual(inner, interpreted.InnerException);
        }
        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 ReformsMessageToIncludeScheduledEventName()
        {
            var id          = Guid.NewGuid();
            var name        = id.ToString("D");
            var message     = id.ToString("N");
            var exception   = new ScheduledEventException(name, message, null);
            var interpreted = new ScheduledEventExceptionInterpreter().Interpret(exception, NullExceptionInterpreter.Instance);

            var expectedInterpretedMessage = $"In Scheduled Event '{name}',";

            Assert.AreEqual(expectedInterpretedMessage, interpreted.Message);
        }
Esempio n. 4
0
        public void PrependsScheduledEventName()
        {
            var id        = Guid.NewGuid();
            var name      = id.ToString("D");
            var message   = id.ToString("N");
            var exception = new ScheduledEventException(name, message, null);
            var projected = new ScheduledEventExceptionInterpreter().Interpret(exception, NullExceptionInterpreter.Instance);

            var expectedProjectedMessage = $"In Scheduled Event '{name}', {message}";

            Assert.AreEqual(expectedProjectedMessage, projected.Message);
        }
        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));
        }