Exemple #1
0
        public IEnumerable <Result> Run(
            Context context,
            ISpecificationRunListener listener,
            RunOptions options,
            IEnumerable <ICleanupAfterEveryContextInAssembly> globalCleanups,
            IEnumerable <ISupplementSpecificationResults> resultSupplementers)
        {
            var results = new List <Result>();

            listener.OnContextStart(context.GetInfo());

            foreach (var specification in context.Specifications)
            {
                var result = Result.Pass();

                if (specification.IsExecutable)
                {
                    result = context.EstablishContext();
                }

                if (result.Passed)
                {
                    var runner = new SpecificationRunner(listener, resultSupplementers);
                    result = runner.Run(specification);
                }
                else
                {
                    results = FailSpecification(listener, specification, result);
                }

                if (specification.IsExecutable)
                {
                    var cleanupResult = context.Cleanup();

                    if (result.Passed && !cleanupResult.Passed)
                    {
                        result = cleanupResult;
                    }

                    foreach (var cleanup in globalCleanups)
                    {
                        cleanup.AfterContextCleanup();
                    }
                }

                results.Add(result);
            }

            listener.OnContextEnd(context.GetInfo());

            return(results);
        }
    private static IEnumerable<Result> RunSpecifications(Context context, ISpecificationRunListener listener, RunOptions options, IEnumerable<ISupplementSpecificationResults> resultSupplementers)
    {
      var results = new List<Result>();
      foreach (var specification in context.Specifications)
      {
        var runner = new SpecificationRunner(listener, options, resultSupplementers);
        var result = runner.Run(specification);

        results.Add(result);
      }

      return results;
    }
Exemple #3
0
        private static IEnumerable <Result> RunSpecifications(Context context, ISpecificationRunListener listener, RunOptions options, IEnumerable <ISupplementSpecificationResults> resultSupplementers)
        {
            var results = new List <Result>();

            foreach (var specification in context.Specifications)
            {
                var runner = new SpecificationRunner(listener, options, resultSupplementers);
                var result = runner.Run(specification);

                results.Add(result);
            }

            return(results);
        }
    public IEnumerable<Result> Run(Context context, ISpecificationRunListener listener, RunOptions options, IEnumerable<ICleanupAfterEveryContextInAssembly> globalCleanups, IEnumerable<ISupplementSpecificationResults> resultSupplementers)
    {
      var results = new List<Result>();
      listener.OnContextStart(context.GetInfo());

      foreach (var specification in context.Specifications)
      {
        Result result = Result.Pass();

        if (specification.IsExecutable)
        {
          result = context.EstablishContext();
        }

        if (result.Passed)
        {
          var runner = new SpecificationRunner(listener, options, resultSupplementers);
          result = runner.Run(specification);
        }
        else
        {
            results = FailSpecification(listener, specification, result);
        }

        if (specification.IsExecutable)
        {
          var cleanupResult = context.Cleanup();

          if (result.Passed && !cleanupResult.Passed)
          {
            result = cleanupResult;
          }

          foreach (var cleanup in globalCleanups)
          {
            cleanup.AfterContextCleanup();
          }
        }

        results.Add(result);
      }

      listener.OnContextEnd(context.GetInfo());

      return results;
    }
    public IEnumerable<Result> Run(Context context, ISpecificationRunListener listener, RunOptions options)
    {
      var results = new List<Result>();
      listener.OnContextStart(context.GetInfo());

      foreach (var specification in context.Specifications)
      {
        Result result = Result.Pass();

        if (specification.IsExecutable)
        {
          result = context.EstablishContext();
        }

        if (result.Passed)
        {
          var runner = new SpecificationRunner(listener, options);
          result = runner.Run(specification);
        }

        if (specification.IsExecutable)
        {
          var cleanupResult = context.Cleanup();

          if (result.Passed && !cleanupResult.Passed)
          {
            result = cleanupResult;
          }
        }

        results.Add(result);
      }

      listener.OnContextEnd(context.GetInfo());

      return results;
    }