コード例 #1
0
 private TypeOfStep DetermineTypeOfStep(StringStep stringStep)
 {
     var step = stringStep.TypeOfStep;
     step = (step == TypeOfStep.Unknown) ? _lastTypeOfStep : step;
     _lastTypeOfStep = step;
     return step;
 }
コード例 #2
0
        private TypeOfStep DetermineTypeOfStep(StringStep stringStep)
        {
            var step = stringStep.TypeOfStep;

            step            = (step == TypeOfStep.Unknown) ? _lastTypeOfStep : step;
            _lastTypeOfStep = step;
            return(step);
        }
コード例 #3
0
ファイル: StringStep.cs プロジェクト: gpolunin/NBehave
 public bool Equals(StringStep other)
 {
     if (other == null)
     {
         return(false);
     }
     return((ReferenceEquals(this, other)) || (other.MatchableStep == MatchableStep && other.Source == Source));
 }
コード例 #4
0
        public Action ResolveStep(StringStep stringStep)
        {
            var methodName = stringStep.Step.Replace(' ', '_');
            var storyType = _methodProvider.GetType();
            var method = storyType.GetMethod(methodName, BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
                                                    null, Type.EmptyTypes, null);
            if (method != null)
                return () => method.Invoke(_methodProvider, new object[0]);

            return null;
        }
コード例 #5
0
        public Action ResolveStep(StringStep stringStep)
        {
            var actionMethodInfo = _actionCatalog.GetAction(stringStep);
            if (actionMethodInfo == null)
                return null;

            var parameters = _parameterConverter.GetParametersForStep(stringStep);
            return () =>
                       {
                           actionMethodInfo.ExecuteNotificationMethod(typeof(BeforeStepAttribute));
                           actionMethodInfo.MethodInfo.Invoke(_stepHelper, parameters);
                           actionMethodInfo.ExecuteNotificationMethod(typeof(AfterStepAttribute));
                       };
        }
コード例 #6
0
        public void Run(StringStep step)
        {
            var stepImplementation = resolvers
                .Select(resolver => resolver.ResolveStep(step))
                .FirstOrDefault(action => action != null);
            if (stepImplementation == null)
            {
                step.PendNotImplemented("No implementation found");
                return;
            }

            try
            {
                stepImplementation();
            }
            catch (Exception ex)
            {
                var realException = FindUsefulException(ex);
                step.Fail(realException);
            }
        }
コード例 #7
0
ファイル: StepResult.cs プロジェクト: smhabdoli/NBehave
 public StepResult(StringStep stringStep, Result resultForActionStep)
     : base(resultForActionStep.Message)
 {
     StringStep = stringStep;
     Result = resultForActionStep;
 }
コード例 #8
0
ファイル: Scenario.cs プロジェクト: smhabdoli/NBehave
 public void AddStep(StringStep step)
 {
     _steps.Add(step);
 }
コード例 #9
0
ファイル: Scenario.cs プロジェクト: smhabdoli/NBehave
 public void AddStep(string step)
 {
     var stringStringStep = new StringStep(step, Source);
     AddStep(stringStringStep);
 }
コード例 #10
0
ファイル: StringStep.cs プロジェクト: AngelPortal/NBehave
 public bool Equals(StringStep other)
 {
     if (other == null)
         return false;
     return (ReferenceEquals(this, other)) || (other.MatchableStep == MatchableStep && other.Source == Source);
 }
コード例 #11
0
 public void Pend(string reason)
 {
     StringStep.Pend(reason);
 }
コード例 #12
0
 public Action ResolveStep(StringStep stringStep)
 {
     Action step;
     return inlineImplementations.TryGetValue(stringStep.Step, out step) ? step : null;
 }
コード例 #13
0
 public StepResult(StringStep stringStep, Result resultForActionStep)
     : base(resultForActionStep.Message)
 {
     StringStep = stringStep;
     Result     = resultForActionStep;
 }
コード例 #14
0
 public string GenerateMethodFor(StringStep step)
 {
     return(GenerateMethodFor(step.Step, DetermineTypeOfStep(step)));
 }
コード例 #15
0
 public void Run(StringStep step, Example example)
 {
     throw new NotSupportedException("NBehave.Spec does not support example-driven scenarios");
 }
コード例 #16
0
        public void AddStep(string step)
        {
            var stringStringStep = new StringStep(step, Source);

            AddStep(stringStringStep);
        }
コード例 #17
0
 public string GenerateMethodFor(StringStep step)
 {
     return GenerateMethodFor(step.Step, DetermineTypeOfStep(step));
 }
コード例 #18
0
 public void AddStep(StringStep step)
 {
     _steps.Add(step);
 }