it seems there are no delegates to properties. Is there a convenient way to do the following?
Assert.Throws<InvalidOperationException>(
delegate
{
// Current is a property as we all know
nullNodeList.GetEnumerator().Current;
});
Fast-forward four years and NUnit now supports this (current version is v2.6 - I've not checked which version this was introduced).
Assert.That(() => nullNodeList.GetEnumerator().Current,
Throws.InvalidOperationException);
Assert.Throws<InvalidOperationException>(
delegate { object current = nullNodeList.GetEnumerator().Current; });
You could try assigning it to a variable or try enumerating:
Assert.Throws<InvalidOperationException>(delegate
{
// Current is a property as we all know
object current = nullNodeList.GetEnumerator().Current;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With