Quantcast
Channel: Fluent Assertions
Viewing all articles
Browse latest Browse all 1402

New Post: Best way to test for exception on class's Default Indexer Property

$
0
0

That's cool, but how would I cleanly test several related OutOfRangeExceptions in one test?

 

myClass[-1].ShouldThrow...
myClass[0].ShouldNotThrow...
myClass[1].ShouldThrow...

If I define a new action for each test as above, that will be a lot of duplicate code.

Ideally I could define an action with a parameter: Action<int> action ... but that doesn't seem to integrate with Fluent Assertions at the moment, unless I'm doing it wrong.

Thanks!

Tony


Viewing all articles
Browse latest Browse all 1402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>