кажется, что нет никаких делегатов в свойствах. Существует ли удобный способ сделать следующее?
Assert.Throws<InvalidOperationException>(
delegate
{
// Current is a property as we all know
nullNodeList.GetEnumerator().Current;
});
Вы можете попробовать присвоить его переменной или перечислить:
Assert.Throws<InvalidOperationException>(delegate
{
// Current is a property as we all know
object current = nullNodeList.GetEnumerator().Current;
});
Assert.Throws<InvalidOperationException>(
delegate { object current = nullNodeList.GetEnumerator().Current; });
почему бы не сказать:
Assert.Throws<InvalidOperationException>(
() => nullNodeList.GetEnumerator().Current);