# Assert\_throws Problem

**URL:** <https://www.ruby-forum.com/t/assert-throws-problem/171697>\
**Category:** IronRuby\
**Created:** [July 7, 2009, 8:27pm UTC](https://www.ruby-forum.com/t/assert-throws-problem/171697 "2009-07-07T20:27:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [July 7, 2009, 8:27pm UTC](https://www.ruby-forum.com/t/assert-throws-problem/171697/1 "2009-07-07T20:27:15Z")

</div>

Hi,

I want to say that whatever exception is thrown just pass the test.

class When\_a\_negative\_number\_is\_passed\_to\_the\_prime\_service \< TestCase

def test\_should\_throw\_an\_exception

primeService = PrimeService.new  
primeService.IsPrime(-2)  
assert\_throws System::Exception

end

end

The exception thrown from the C# side is ArgumentException
