I have discovered that these seem to be the two main ways of testing for exceptions:
Assert.Throws<Exception>(()=>MethodThatThrows());
[ExpectedException(typeof(Exception))]
Which of these would be best? Does one offer advantages over the other? Or is it simply a matter of personal preference?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…