Ejemplo n.º 1
0
 public static CaseResult Failed(string name, TimeSpan duration, ExceptionInfo exceptionSummary)
 {
     return new CaseResult(name, CaseStatus.Failed, duration)
     {
         ExceptionSummary = exceptionSummary
     };
 }
Ejemplo n.º 2
0
        public FailResult(CaseExecution execution, AssertionLibraryFilter filter)
        {
            Case = execution.Case;
            Output = execution.Output;
            Duration = execution.Duration;
            Exceptions = execution.Exceptions;

            ExceptionSummary = new ExceptionInfo(Exceptions, filter);
        }
Ejemplo n.º 3
0
        public void ShouldFilterAssertionLibraryImplementationDetails()
        {
            var primaryException = GetPrimaryException();
            var secondaryExceptionA = new NotImplementedException();
            var secondaryExceptionB = GetSecondaryException();

            assertionLibrary
                .For<PrimaryException>()
                .For<SecondaryException>()
                .For<ExceptionInfoTests>();

            var exceptionInfo = new ExceptionInfo(new[] { primaryException, secondaryExceptionA, secondaryExceptionB }, assertionLibrary);

            exceptionInfo.DisplayName.ShouldEqual("");
            exceptionInfo.Type.ShouldEqual("Fixie.Tests.Results.ExceptionInfoTests+PrimaryException");
            exceptionInfo.Message.ShouldEqual("Primary Exception!");
            exceptionInfo.StackTrace
                .Split(new[] { Environment.NewLine }, StringSplitOptions.None)
                .Select(x => Regex.Replace(x, @":line \d+", ":line #")) //Avoid brittle assertion introduced by stack trace line numbers.
                .ShouldEqual(
                    "Primary Exception!",
                    "",
                    "",
                    "------- Inner Exception: System.DivideByZeroException -------",
                    "Divide by Zero Exception!",
                    "",
                    "",
                    "===== Secondary Exception: System.NotImplementedException =====",
                    "The method or operation is not implemented.",
                    "",
                    "",
                    "===== Secondary Exception: Fixie.Tests.Results.ExceptionInfoTests+SecondaryException =====",
                    "Secondary Exception!",
                    "",
                    "",
                    "------- Inner Exception: System.ApplicationException -------",
                    "Application Exception!",
                    "",
                    "",
                    "------- Inner Exception: System.NotImplementedException -------",
                    "Not Implemented Exception!",
                    "");

            exceptionInfo.InnerException.ShouldBeNull();
        }
Ejemplo n.º 4
0
        public void ShouldSummarizeTheGivenException()
        {
            var exception = GetPrimaryException();

            var exceptionInfo = new ExceptionInfo(exception, assertionLibrary);

            exceptionInfo.DisplayName.ShouldEqual("Fixie.Tests.Results.ExceptionInfoTests+PrimaryException");
            exceptionInfo.Type.ShouldEqual("Fixie.Tests.Results.ExceptionInfoTests+PrimaryException");
            exceptionInfo.Message.ShouldEqual("Primary Exception!");
            exceptionInfo.StackTrace.ShouldEqual(exception.StackTrace);

            exceptionInfo.InnerException.DisplayName.ShouldEqual("System.DivideByZeroException");
            exceptionInfo.InnerException.Type.ShouldEqual("System.DivideByZeroException");
            exceptionInfo.InnerException.Message.ShouldEqual("Divide by Zero Exception!");
            exceptionInfo.InnerException.StackTrace.ShouldEqual(exception.InnerException.StackTrace);

            exceptionInfo.InnerException.InnerException.ShouldBeNull();
        }