예제 #1
0
 internal BddResult(ITestOutputHelper output, StepQueue stepQueue)
 {
     _output = output;
     stepQueue.Steps.ForEach(x =>
     {
         try
         {
             x.Step?.Invoke();
         }
         catch (NotImplementedException e)
         {
             _errors.Add(e);
         }
         catch (Exception e)
         {
             _errors.Add(e);
         }
     });
     _errors.ForEach(x => _output.WriteLine($"{x.Message}\r\n"));
     _story = stepQueue.Story();
     _output.WriteLine(_story);
     if (!Success)
     {
         throw new TestFailureException("Test Failed. See output for more details.", _story, _errors);
     }
 }
예제 #2
0
        private void Evaluate()
        {
            if (_invoked)
            {
                _output.WriteLine(_story);
                return;
            }

            try
            {
                _stepQueue.Steps.ForEach(x =>
                {
                    try
                    {
                        x.Step?.Invoke();
                    }
                    catch (NotImplementedException e)
                    {
                        _errors.Add(e);
                    }
                    catch (Exception e)
                    {
                        _errors.Add(e);
                    }
                });
                _errors.ForEach(x => _output.WriteLine($"{x.Message}\r\n"));
                _story = _stepQueue.Story();
                _output.WriteLine(_story);
                if (!Success)
                {
                    throw new TestFailureException("Test Failed. See output for more details.", _story, _errors);
                }
            }
            finally
            {
                _invoked = true;
            }
        }