nunit / nunit-vs-adapter

Runs NUnit V2 tests inside the Visual Studio 2012 or later Test Explorer window.
MIT License
50 stars 43 forks source link

VS2015 Intellisense recognizing [Test] attribute... but NOT [ExpectedException] - bug?? #151

Closed markvogt closed 7 years ago

markvogt commented 7 years ago

SHORT STORY: VS2015 Intellisense with JUnit package added to solution DOES recognize [Test] atttribute, but DOESN'T recognise [ExpectedException(typeof(stuff))] or [Test, ExpectedException(typeof(stuff))] :-( ...

DETAILS:

  1. veteran VS/C#/SharePoint developer; newbie in some newer tools (hey, it happens - or will - to ALL of us);
  2. dev VM running Windows Server 2012 R2 64 bit | Visual Studio 2015 Premium | NUnit VS Test Adapter v3
  3. Solution is a Classic Windows Forms Application:
    • added class library to hold all test classes;
    • added NUnit package via Solution>rightmouseclick>manage NuGet packages;
    • selected to auto-install & configure NUnit in all projects in solution;
    • manually added "using Nunit.framework;" to top of test class library cs file

RESULT

  1. when I start decorating the class with [Test Fixture] and the methods with [Test], everything (ie Intellisense) works as expected, and my first 6-7 test classes run just fine inside the VS IDE using the cool TestExplorer window :-) ...

BUT

... when I try to create an EXCEPTION test class and decorate that method with [ExpectedException], as soon as I start typing "[Exp"... Intellisense stops returning any results :-( .

Thoughts?

Mark in North Aurora

OsirisTerje commented 7 years ago

Intellisense is fantastic :-) It actually tries to tell you there is no ExpectedException attribute in NUnit3 and indeed it is correct :-)
It has been deprecated, and you should use the Assert.Throw, see https://github.com/nunit/docs/wiki/Assert.Throws and https://github.com/nunit/docs/wiki/Assert.ThrowsAsync or Assert.That ( somemethod, Throws ) instead, see https://github.com/nunit/docs/wiki/ThrowsConstraint

I see you say you use NUnit 3 adapter, and then you also use NUnit3.

markvogt commented 7 years ago

Osiris, Thanks ! -Mark