$ 0 0 Just do something like this. Action action => () => { var testValue = myClass[5]; } action.ShouldThrow("because...");