Resharper fails to recognize exceptions ?

Hello !

Here is simple unit test with NUnit framework.

public class Class1
    {
        [Test]
        [ExpectedException(typeof(SystemException))]
        public void ThrowsApplicationException()
        {
            throw new ApplicationException();
        }
    }


This test fails in NUnit test runner, but succedes in Resharper test runner.

Thanks!

3 comments
Comment actions Permalink

Hello Alexey
     Which version of NUnit are you using? Does this test fail in NUnit 2.5.3 test runner? Thank you!

Andrey Serebryansky

Support Engineer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"
0
Comment actions Permalink

I'm using NUnit 2.4.8. There is different behaviour in 2.4.8 and 2.5.3 This test succedes in 2.5.3

P.S. here is bug description: https://bugs.launchpad.net/nunitv2/+bug/498662

Thanks for your answer !

0
Comment actions Permalink

Hi, i've got the same issue (also Nunit 2.4.8)
We're planning on upgrading N-unit, but in the mean while, will there be a fix for resharper?

Sample code:

          // Test succeeds

        [Test,ExpectedException(typeof(SqlException))]

        public void ShouldFailBecauseOfWrongExceptionType()

        {

            throw new ArgumentException();

        }

        // Test Fails

        [Test, ExpectedException(typeof(SqlException))]
        public void ShouldFailBecauseNoExceptionIsThrown()
        {
            
        }

Resharper version details:
JetBrains ReSharper 5 C# Edition
Build 5.0.1659.36 on 2010-04-13T02:19:06

0

Please sign in to leave a comment.