Пример #1
0
        protected virtual void WriteException(IErrorWriter w, Exception exc)
        {
            if (exc.InnerException != null) WriteException(w, exc.InnerException);

            var source = ExtractSource(exc);

            w.Write("<div class='exception'><span class='exceptionType'>");
            w.WriteText(exc.GetType().FullName);
            w.Write("</span><span class='exceptionMessage'>");
            w.WriteText(exc.Message);
            w.Write("</span>");
            if (source != null)
            {
                w.WriteSourceCode(source, false);
            }
            w.Write("</div><hr />");
        }
Пример #2
0
        public int Run()
        {
            var builds = from file in GetProjectFiles()
                         let projectDirectory = Path.GetDirectoryName(file)
                                                let expectedResultsFile = Path.Combine(projectDirectory, "expectedResults.xml")
                                                                          let expectedResults = ReadExpectedResults(expectedResultsFile)
                                                                                                select new BuildState(new FileInfo(file), expectedResults);

            var buildList = builds.ToList();

            logger.Debug("Building {0} integration tests.", buildList.Count);

            foreach (var build in buildList)
            {
                logger.Debug("Building {0}...", build.ProjectFile.FullName);
                if (!ExecuteBuild(build))
                {
                    var err = new ValidationError(ValidationErrorType.BuildFailed, string.Empty, build.ProjectFile);
                    errorWriter.Write(err);
                    ++numTestsFailed;
                    continue;
                }

                var validator = new AssemblyValidator(
                    build.ProjectFile,
                    build.OutputAssembly.FullName,
                    build.ExpectedResults);

                logger.Debug("Validating {0}...", build.ProjectFile.FullName);
                var errors = validator.Validate();

                foreach (var error in errors)
                {
                    errorWriter.Write(error);
                }

                if (errors.Count > 0)
                {
                    ++numTestsFailed;
                }
            }

            logger.Debug("Test run finished with {0} failure{1}", numTestsFailed, numTestsFailed == 1 ? string.Empty : "s");
            return(numTestsFailed);
        }
Пример #3
0
        public void WriteHead(IErrorWriter w)
        {
            w.Write(@"
.exception .exceptionType:after { content: ': '; }
.exception .exceptionType { font-size: 1.2em; font-weight: bold; }
.exception .exceptionMessage { font-style: italic; }
.exceptionStackTrace {  }
.exceptionStackTrace .frame { padding: 2px; margin: 0 0 0 30px; border-bottom: 1px #ddd solid; }
.exceptionStackTrace .frame:hover { background-color: #f0f0f0; }
");
        }
Пример #4
0
        protected virtual void WriteException(IErrorWriter w, Exception exc)
        {
            if (exc.InnerException != null)
            {
                WriteException(w, exc.InnerException);
            }

            var source = ExtractSource(exc);

            w.Write("<div class='exception'><span class='exceptionType'>");
            w.WriteText(exc.GetType().FullName);
            w.Write("</span><span class='exceptionMessage'>");
            w.WriteText(exc.Message);
            w.Write("</span>");
            if (source != null)
            {
                w.WriteSourceCode(source, false);
            }
            w.Write("</div><hr />");
        }
Пример #5
0
 protected virtual void WriteException(IErrorWriter w, ExceptionModel model)
 {
     if (model.InnerException != null)
     {
         WriteException(w, model.InnerException);
     }
     w.Write("<div class='exception'><span class='exceptionType'>");
     w.WriteText(model.TypeName);
     w.Write("</span><span class='exceptionMessage'>");
     w.WriteText(model.Message);
     w.Write("</span><hr />");
     if (model.AdditionalInfo != null && model.AdditionalInfo.Length > 0)
     {
         w.Write("<div class='exceptionAdditionalInfo'>");
         foreach (var info in model.AdditionalInfo)
         {
             w.Write("<div> <h3>");
             w.WriteText(info.Title);
             w.Write("</h3>");
             if (info.Objects != null)
                 foreach (var obj in info.Objects)
                 {
                     if (info.Display == ExceptionAdditionalInfo.DisplayMode.ToString)
                     {
                         w.Write("<p>" + WebUtility.HtmlEncode(obj.ToString()) + "</p>");
                     }
                     else if (info.Display == ExceptionAdditionalInfo.DisplayMode.ObjectBrowser)
                     {
                         w.ObjectBrowser(obj);
                     }
                 }
             w.Write("</div><hr />");
         }
         w.Write("</div>");
     }
     w.ObjectBrowser(model.OriginalException);
     w.Write("<hr /><div class='exceptionStackTrace'>");
     foreach (var frame in model.Stack)
     {
         w.Write("<div class='frame'><span class='method code'>");
         w.WriteText(FormatMethod(frame.Method));
         w.Write(" </span>");
         if (frame.At.FileName != null) w.WriteText(frame.At.FileName + " +" + frame.At.LineNumber);
         w.Write("<span class='docLinks'>");
         foreach (var icon in frame.MoreInfo)
         {
             w.Write("<a target=\"_blank\" href='" + icon.Link + "'>");
             w.Write(icon.ContentHtml);
             w.Write("</a>");
         }
         w.Write("</span>");
         w.WriteSourceCode(frame.At);
         w.Write("</div>");
     }
     w.Write("</div>");
     w.Write("</div>");
 }
Пример #6
0
        public void WriteHead(IErrorWriter w)
        {
            w.Write(@"
.exception .exceptionType:after { content: ': '; }
.exception .exceptionType { font-size: 1.2em; font-weight: bold; }
.exception .exceptionMessage { font-style: italic; }
.exceptionStackTrace {  }
.exceptionStackTrace .frame { padding: 2px; margin: 0 0 0 30px; border-bottom: 1px #ddd solid; }
.exceptionStackTrace .frame:hover { background-color: #f0f0f0; }
");
        }
Пример #7
0
 protected virtual void WriteException(IErrorWriter w, ExceptionModel model)
 {
     if (model.InnerException != null)
     {
         WriteException(w, model.InnerException);
     }
     w.Write("<div class='exception'><span class='exceptionType'>");
     w.WriteText(model.TypeName);
     w.Write("</span><span class='exceptionMessage'>");
     w.WriteText(model.Message);
     w.Write("</span><hr />");
     if (model.AdditionalInfo != null && model.AdditionalInfo.Length > 0)
     {
         w.Write("<div class='exceptionAdditionalInfo'>");
         foreach (var info in model.AdditionalInfo)
         {
             w.Write("<div> <h3>");
             w.WriteText(info.Title);
             w.Write("</h3>");
             if (info.Objects != null)
             {
                 foreach (var obj in info.Objects)
                 {
                     if (info.Display == ExceptionAdditionalInfo.DisplayMode.ToString)
                     {
                         w.Write("<p>" + WebUtility.HtmlEncode(obj.ToString()) + "</p>");
                     }
                     else if (info.Display == ExceptionAdditionalInfo.DisplayMode.ObjectBrowser)
                     {
                         w.ObjectBrowser(obj);
                     }
                 }
             }
             w.Write("</div><hr />");
         }
         w.Write("</div>");
     }
     w.ObjectBrowser(model.OriginalException);
     w.Write("<hr /><div class='exceptionStackTrace'>");
     foreach (var frame in model.Stack)
     {
         w.Write("<div class='frame'><span class='method code'>");
         w.WriteText(FormatMethod(frame.Method));
         w.Write(" </span>");
         if (frame.At.FileName != null)
         {
             w.WriteText(frame.At.FileName + " +" + frame.At.LineNumber);
         }
         w.Write("<span class='docLinks'>");
         foreach (var icon in frame.MoreInfo)
         {
             w.Write("<a target=\"_blank\" href='" + icon.Link + "'>");
             w.Write(icon.ContentHtml);
             w.Write("</a>");
         }
         w.Write("</span>");
         w.WriteSourceCode(frame.At);
         w.Write("</div>");
     }
     w.Write("</div>");
     w.Write("</div>");
 }