Ejemplo n.º 1
0
 public void Verify()
 {
     try
     {
         TestRunner.Verify(_actionUnderTest.Description,
                           _parameterActions,
                           () => _performAction(_actionContainer),
                           _dependencyActions,
                           _assertions);
     }
     catch (Exception e)
     {
         Exception result    = null;
         bool      succeeded = true;
         try
         {
             result = new ExceptionRewriter().RewriteStacktrace(e);
         }
         catch
         {
             succeeded = false;
         }
         if (!succeeded)
         {
             throw;
         }
         throw result;
     }
 }
Ejemplo n.º 2
0
        public static void VerifyThrowsException <TExceptionType>(string expectedExceptionMessage, params Action[] actions)
            where TExceptionType : Exception
        {
            var exceptionConfiguration = new ExceptionConfiguration(typeof(TExceptionType), expectedExceptionMessage);

            try
            {
                new TestVerifyClause(exceptionConfiguration).Verify(actions);
            }
            catch (Exception e)
            {
                Exception result    = null;
                bool      succeeded = true;
                try
                {
                    result = new ExceptionRewriter().RewriteStacktrace(e);
                }
                catch
                {
                    succeeded = false;
                }
                if (!succeeded)
                {
                    throw;
                }
                throw result;
            }
        }
Ejemplo n.º 3
0
 public void Verify(params Action[] actions)
 {
     try
     {
         var testStepCreators = new ITestStepCreator[] { new WithTestStep(), new WhenTestStep(), new ExpectTestStep(), new ShouldTestStep(), new DefaultTestStep() };
         var steps            = actions.Select(x => TestStepCreator(testStepCreators, x)).ToList();
         Verify(steps, _exceptionConfiguration);
     }
     catch (Exception e)
     {
         Exception result    = null;
         bool      succeeded = true;
         try
         {
             result = new ExceptionRewriter().RewriteStacktrace(e);
         }
         catch
         {
             succeeded = false;
         }
         if (!succeeded)
         {
             throw;
         }
         throw result;
     }
 }
Ejemplo n.º 4
0
 public static void Verify(params Action[] actions)
 {
     try
     {
         new TestVerifyClause().Verify(actions);
     }
     catch (Exception e)
     {
         Exception result    = null;
         bool      succeeded = true;
         try
         {
             result = new ExceptionRewriter().RewriteStacktrace(e);
         }
         catch
         {
             succeeded = false;
         }
         if (!succeeded)
         {
             throw;
         }
         throw result;
     }
 }
 public void BeforeEachTest()
 {
     _rewriter = new ExceptionRewriter();
 }