Exemplo n.º 1
0
        public void GetStepDefinitions_should_return_all_step_definitions()
        {
            var sut = new BindingRegistry();

            var stepDefinitionBinding1 = new StepDefinitionBinding(StepDefinitionType.Given, @"foo.*", new Mock <IBindingMethod>().Object, null);
            var stepDefinitionBinding2 = new StepDefinitionBinding(StepDefinitionType.When, @"bar.*", new Mock <IBindingMethod>().Object, null);

            sut.RegisterStepDefinitionBinding(stepDefinitionBinding1);
            sut.RegisterStepDefinitionBinding(stepDefinitionBinding2);

            var result = sut.GetStepDefinitions();

            result.Should().BeEquivalentTo(stepDefinitionBinding1, stepDefinitionBinding2);
        }
        private void RegisterStepDefinitionBinding(string regex = "I press add", StepDefinitionType type = StepDefinitionType.When, string method = nameof(StubBindingClass.WhenIPressAdd), BindingScope scope = null)
        {
            var methodInfo = GetMethodInfo(method);

            _bindingRegistry.RegisterStepDefinitionBinding(new StepDefinitionBinding(type, regex, new RuntimeBindingMethod(methodInfo), scope));
        }