次のコードで単体テストのカバレッジを取得したいと思います。
public static class ExceptionExtensions {
public static IEnumerable<Exception> SelfAndAllInnerExceptions(
this Exception e) {
yield return e;
while (e.InnerException != null) {
e = e.InnerException; //5
yield return e; //6
}
}
}
編集:このコードをテストするのにMolesは必要なかったようです。また、5行目と6行目が逆になっているバグがありました。