Ejemplo n.º 1
0
        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()));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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)));
        }