Exemple #1
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);
        }
Exemple #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;
        }