public void NameGivesTypeName() { // given var target = new CrashFormatter(new ArgumentException("some message")); // when var obtained = target.Name; // then Assert.That(obtained, Is.EqualTo(typeof(ArgumentException).ToString())); }
public void ReasonGivesExceptionMessage() { // given const string exceptionMessage = "Austria erit in orbe ultima"; var target = new CrashFormatter(new ArgumentException(exceptionMessage)); // when var obtained = target.Reason; // then Assert.That(obtained, Is.EqualTo(exceptionMessage)); }
public void StackTraceGivesExceptionStackTrace() { // given Exception caught = null; try { CreateRecurisveCrash("foobar", 10); } catch (Exception e) { caught = e; } Assert.That(caught, Is.Not.Null); var target = new CrashFormatter(caught); // when var obtained = target.StackTrace; // then Assert.That(obtained, Is.EqualTo(caught.StackTrace.Replace(Environment.NewLine, CrashFormatter.NewLine))); }