Bug 3880 - [newresolver] nunit doesn't fail if exception is thrown during test
Summary: [newresolver] nunit doesn't fail if exception is thrown during test
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NUnit ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-03-13 14:41 UTC by Stephen Shaw
Modified: 2012-03-14 02:59 UTC (History)
1 user (show)

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


Attachments
possible fix (1.08 KB, patch)
2012-03-13 15:10 UTC, Csaba Halász
Details


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:
Status:
RESOLVED FIXED

Description Stephen Shaw 2012-03-13 14:41:07 UTC
This seems to only be an issue with nunit 2.6.0.12051 in monodevelop.  I downloaded nunit from nunit.org and run my dll with it and the test failed as expected.

If you write a test against a method that only throws an exception the test pass.  This is without expectedexception.

Here is a test case:


using System;

namespace FizzBuzz
{	
	public class Translator
	{
		public static string Translate (int i)
		{
			throw new NotImplementedException ();
		}
	}
}


using NUnit.Framework;

namespace FizzBuzz
{
	[TestFixture]
	public class FizzBuzzTests
	{
		[Test]
		public void TranslateOne ()
		{
			string result = Translator.Translate (1);
			Assert.That (result, Is.EqualTo ("1"));
		}
	}
}
Comment 1 Csaba Halász 2012-03-13 15:10:44 UTC
Created attachment 1512 [details]
possible fix
Comment 2 Stephen Shaw 2012-03-13 16:53:38 UTC
I just applied the patch to newresolver and now it works for me.
Comment 3 Mike Krüger 2012-03-14 02:59:01 UTC
fixed that one.