public void Visit(Run run)
    {
      _firstNotImplemented = null;
      _lastNotImplemented = null;

      run.Assemblies.Each(Visit);

      run.NextNotImplemented = _firstNotImplemented;
    }
    public void Visit(Run run)
    {
      _firstFail = null;
      _lastFail = null;

      run.Assemblies.Each(Visit);

      run.NextFailed = _firstFail;
    }
    public void Visit(Run run)
    {
      _firstIgnored = null;
      _lastIgnored = null;

      run.Assemblies.Each(Visit);

      run.NextIgnored = _firstIgnored;
    }
    public void GenerateReport(Run run)
    {
      run.Meta.ShouldGenerateTimeInfo = _showTimeInfo;

      Func<string, string> resourcePathCreator = p => String.Empty;
      Action<Run> writeReport = r => { };

      if (_fileSystem.IsValidPathToDirectory(_path))
      {
        resourcePathCreator = p => CreateResourceDirectoryIn(p);
        writeReport = r => WriteReportsToDirectory(r);
      }
      else if (_fileSystem.IsValidPathToFile(_path))
      {
        resourcePathCreator = p => CreateResourceDirectoryIn(Path.GetDirectoryName(p));
        writeReport = r => WriteReportToFile(r, _path);
      }

      _resources = resourcePathCreator(_path);
      writeReport(run);
    }
    void WriteReportsToDirectory(Run run)
    {
      var indexFilePath = GetIndexFilePath();

      run.Assemblies
        .Select(assembly => new Run(new[] { assembly })
                            {
                              Meta =
                                {
                                  GeneratedAt = run.Meta.GeneratedAt,
                                  ShouldGenerateTimeInfo = run.Meta.ShouldGenerateTimeInfo,
                                  ShouldGenerateIndexLink = true,
                                  IndexLink = Path.GetFileName(indexFilePath)
                                }
                            })
        .Each(assembyRun =>
          {
            var path = GetReportFilePath(assembyRun);
            WriteReportToFile(assembyRun, path);
          });

      WriteIndexToFile(run, indexFilePath);
    }
 public void Visit(Run run)
 {
   run.Assemblies.Each(Visit);
 }
 static void Render(SparkView template, Run run, TextWriter writer)
 {
   template.Model = run;
   template.RenderView(writer);
 }
    public void RenderIndex(Run run, TextWriter writer)
    {
      var template = (SparkView)_engine.CreateInstance(_index);

      Render(template, run, writer);
    }
    static void RunDefaultVisitors(Run run)
    {
      var fileSystem = MockRepository.GenerateStub<IFileSystem>();
      fileSystem
        .Stub(x => x.Move(Arg<string>.Matches(y => y.EndsWith("-should-fail-copy")), Arg<string>.Is.Anything))
        .Throw(PrepareException());

      new ISpecificationVisitor[]
      {
        new FailedSpecificationLinker(),
        new NotImplementedSpecificationLinker(),
        new FileBasedResultSupplementPreparation(fileSystem)
      }
        .Each(x => x.Visit(run));
    }
 public virtual void OnRunEnd()
 {
   _run = new Run(_assemblies);
 }
 void WriteIndexToFile(Run run, string path)
 {
   WriteReport(path, run, (renderer, writer, theRun) => renderer.RenderIndex(theRun, writer));
 }
 string GetReportFilePath(Run run)
 {
   return String.Format("{0}.html", Path.Combine(_path, run.Assemblies.First().Name));
 }
    void WriteReport(string path, Run run, Action<ISparkRenderer, TextWriter, Run> renderAction)
    {
      _specificationVisitors.Each(x => x.Initialize(new VisitorContext { ResourcePath = _resources }));
      _specificationVisitors.Each(x => x.Visit(run));

      _fileSystem.DeleteIfFileExists(path);

      using (var writer = _streamFactory(path))
      {
        renderAction(_renderer, writer, run);
      }
    }
 public void Visit(Run run)
 {
 }