Bug 24635 - Nunit runner has trouble when class with TestFixture is defined without a namespace.
Summary: Nunit runner has trouble when class with TestFixture is defined without a nam...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NUnit ()
Version: 5.5
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 5.7
Assignee: Mike Krüger
Depends on:
Reported: 2014-11-18 22:09 UTC by David Thornley
Modified: 2014-11-28 04:45 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description David Thornley 2014-11-18 22:09:43 UTC
Simply create a new nunit library project and remove the "namespace <project> {" line (and associated "}") in the code unit, effectively placing them in the default project namespace.

The 'Unit Tests' pad enumerates and finds the tests fine and allows them to be run, however 'Show test code' is greyed out and sometimes (not always) generates an exception.

More importantly, exceptions generated within the tests are not displayed in the test results pad.

Exception generated: -

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Argument cannot be null.
Parameter name: namespaceName
  at ICSharpCode.NRefactory.TypeSystem.TopLevelTypeName..ctor (System.String namespaceName, System.String name, Int32 typeParameterCount) [0x00038] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-5.5-branch/0ba6e460/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory/TypeSystem/TopLevelTypeName.cs:45 

It looks like the nunit runner makes assumptions about the presence of a root(toplevel) namespapce.

The only reason I found this is that xunit seems to not favour using additional namespaces by default. The unit test library I have contains some basic tests that share nunit (for XS on osx) and xunit (for VS on windows). You guys need to add xunit support to XS! :)
Comment 1 Mike Krüger 2014-11-19 09:13:04 UTC
fixed in
Comment 2 Sadik Ali 2014-11-28 04:45:07 UTC
I have checked this issue and observed that TestFixture class without namespace working fine as shown in Screencast: http://www.screencast.com/t/UBaabbOh5a

Hence ,Closing this issue.

XS 5.7(Build 596)