public void Throws_CreatesException() { var methodCall = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine()); var subject = new Setup(methodCall); subject.Throws<ArgumentException>(); Assert.NotNull(subject.Exception); Assert.NotNull(subject.Exception.Value); Assert.IsInstanceOf<ArgumentException>(subject.Exception.Value); }
public void ThrowsInstance_SetsExceptionToInstance() { var methodCall = TestDataFactory.CreateMethodCallInfo(() => Console.WriteLine()); var subject = new Setup(methodCall); var exception = new ArgumentException(); subject.Throws(exception); Assert.NotNull(subject.Exception); Assert.AreSame(exception, subject.Exception.Value); }