private bool validateOnly(RunInput input, SystemRecycled systemRecycled)
        {
            var fixtures = buildFixturesWithOverrides(input, systemRecycled);
            var library  = FixtureLibrary.From(fixtures);

            var specs = HierarchyLoader.ReadHierarchy(input.SpecPath).GetAllSpecs().ToArray();

            SpecificationPostProcessor.PostProcessAll(specs, library);

            var errored = specs.Where(x => x.errors.Any()).ToArray();

            if (errored.Any())
            {
                ConsoleWriter.Write(ConsoleColor.Red, "Errors Detected!");

                foreach (var errorSpec in errored)
                {
                    ConsoleWriter.Write(ConsoleColor.Yellow, errorSpec.Filename);
                    foreach (var error in errorSpec.errors)
                    {
                        Console.WriteLine($"{error.location.Join(" / ")} -> {error.message}");
                    }
                }

                return(false);
            }
            else
            {
                ConsoleWriter.Write(ConsoleColor.Green, "No validation errors or missing data detected in this project");
                return(true);
            }
        }
        public static string BuildPage(IApplication application)
        {
            var top     = application.Persistence.Hierarchy.Top;
            var library = FixtureLibrary.From(application.Fixtures.CombinedFixtures());
            var title   = "Specifications Visualization";

            return(Build(top, library, title).ToString());
        }
        public void PostProcessAll(IEnumerable <Specification> specifications)
        {
            var combined = FixtureLibrary.From(CombinedFixtures());

            lock (_processorLock)
            {
                SpecificationPostProcessor.PostProcessAll(specifications, combined);
            }
        }
        public static FixtureLibrary BuildCombinedFixtureLibrary(ProjectInput input, EngineController controller)
        {
            var loading = controller.Start();

            var reading = Task.Factory.StartNew(() => FixtureLoader.LoadFromPath(input.FixturePath));

            Task.WaitAll(loading, reading);

            var combined = FixtureLibrary.From(loading.Result.fixtures)
                           .ApplyOverrides(reading.Result);

            return(combined);
        }
Пример #5
0
        public static FixtureLibrary LoadFromPath(string path)
        {
            if (!Directory.Exists(path))
            {
                ConsoleWriter.Write(ConsoleColor.White, "Created directory " + path);
                Directory.CreateDirectory(path);
            }

            var fixturePaths = Directory.GetFiles(path)
                               .Where(file =>
                                      Path.GetExtension(file).Equals(
                                          ".md",
                                          StringComparison.OrdinalIgnoreCase));

            var fixtures = fixturePaths.Select(FixtureReader.ReadFromFile).ToArray();

            return(FixtureLibrary.From(fixtures));
        }
Пример #6
0
 public void RecordSystemFixtures(SystemRecycled recycled)
 {
     _systemFixtures = FixtureLibrary.From(recycled.fixtures);
 }
Пример #7
0
        public void PostProcess(Specification spec)
        {
            var combined = FixtureLibrary.From(CombinedFixtures());

            new SpecificationPostProcessor(combined, spec).Validate();
        }