Ejemplo n.º 1
0
        public Config WithPathsRelativeTo(string baseDirectory)
        {
            return(new Config
            {
                SolutionFilePath = SolutionFilePath != null
                    ? Path.Combine(baseDirectory, SolutionFilePath)
                    : null,

                TestAssemblyFilePaths = TestAssemblyFilePaths?
                                        .Select(x => x != null ? Path.Combine(baseDirectory, x) : null)
                                        .ToArray(),

                ProjectFilters = ProjectFilters?.ToArray(),
                SourceFileFilters = SourceFileFilters?.ToArray()
            });
        }
Ejemplo n.º 2
0
        private IEnumerable <string> ValidateRequiredPropertiesArePresent()
        {
            string PropertyNotSpecified(string propertyName)
            {
                return($"The property \"{propertyName}\" is required but hasn't been specified in the configuration.");
            }

            if (SolutionFilePath == null)
            {
                yield return(PropertyNotSpecified(nameof(SolutionFilePath)));
            }

            if (TestAssemblyFilePaths == null || !TestAssemblyFilePaths.Any())
            {
                yield return(PropertyNotSpecified(nameof(TestAssemblyFilePaths)));
            }
        }
Ejemplo n.º 3
0
        private IEnumerable <string> ValidateFilesArePresent()
        {
            if (SolutionFilePath != null && !File.Exists(SolutionFilePath))
            {
                yield return
                    ($"The solution file was not found: \"{SolutionFilePath}\"");
            }

            if (TestAssemblyFilePaths != null)
            {
                var nonExistentTestAssemblies = TestAssemblyFilePaths.Where(f => !File.Exists(f)).ToList();
                if (nonExistentTestAssemblies.Any())
                {
                    var filesListMessage = string.Join(Environment.NewLine, nonExistentTestAssemblies);
                    yield return
                        ($"One or more test assemblies were not found:{Environment.NewLine}{filesListMessage}");
                }
            }
        }