コード例 #1
0
 private static JObject ToJson(ValidationError error)
 {
     return new JObject(
         new JProperty("type", error.Type.ToString()),
         new JProperty("message", error.Message),
         new JProperty("project", error.ProjectFile.FullName));
 }
コード例 #2
0
 public override void Write(ValidationError error)
 {
     Writer.Write(error.Type.ToString());
     Writer.Write(Separator);
     Writer.Write(EscapeMessage(error.Message));
     Writer.Write(Separator);
     Writer.Write(error.ProjectFile.FullName);
     Writer.WriteLine();
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: benjamin-bader/stiletto
        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;
        }
コード例 #4
0
 public override void Write(ValidationError error)
 {
     serializer.Serialize(Writer, ToJson(error));
 }
コード例 #5
0
 public abstract void Write(ValidationError error);
コード例 #6
0
 public abstract void Write(ValidationError error);