public void ShouldFindBinding_WithDefaultOrder() { var builder = new RuntimeBindingRegistryBuilder(bindingSourceProcessorStub); builder.BuildBindingsFromType(typeof(ScopedHookExample)); Assert.AreEqual(4, bindingSourceProcessorStub.HookBindings.Count(s => s.HookOrder == 10000)); }
public void ShouldFindStepDefinitionsWithTranslatedAttributes() { var builder = new RuntimeBindingRegistryBuilder(bindingSourceProcessorStub, new SpecFlowAttributesFilter()); builder.BuildBindingsFromType(typeof(BindingClassWithTranslatedStepDefinitionAttributes)); Assert.Equal(3, bindingSourceProcessorStub.StepDefinitionBindings.Count); Assert.Equal(1, bindingSourceProcessorStub.StepDefinitionBindings.Count(b => b.StepDefinitionType == StepDefinitionType.Given)); Assert.Equal(1, bindingSourceProcessorStub.StepDefinitionBindings.Count(b => b.StepDefinitionType == StepDefinitionType.When)); Assert.Equal(1, bindingSourceProcessorStub.StepDefinitionBindings.Count(b => b.StepDefinitionType == StepDefinitionType.Then)); }
public void ShouldFindBinding_WithSpecifiedPriorities() { var builder = new RuntimeBindingRegistryBuilder(bindingSourceProcessorStub); builder.BuildBindingsFromType(typeof(PrioritisedHookExample)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.BeforeScenario && s.Method.Name == "OrderTenThousand" && s.HookOrder == 10000)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.BeforeScenario && s.Method.Name == "OrderNineThousand" && s.HookOrder == 9000)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.BeforeScenarioBlock && s.Method.Name == "OrderTenThousandAnd1" && s.HookOrder == 10001)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.BeforeFeature && s.Method.Name == "OrderTenThousandAnd2" && s.HookOrder == 10002)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.BeforeStep && s.Method.Name == "OrderTenThousandAnd3" && s.HookOrder == 10003)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.BeforeTestRun && s.Method.Name == "OrderTenThousandAnd4" && s.HookOrder == 10004)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.AfterScenario && s.Method.Name == "AfterOrderTenThousand" && s.HookOrder == 10000)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.AfterScenario && s.Method.Name == "AfterOrderNineThousand" && s.HookOrder == 9000)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.AfterScenarioBlock && s.Method.Name == "AfterOrderTenThousandAnd1" && s.HookOrder == 10001)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.AfterFeature && s.Method.Name == "AfterOrderTenThousandAnd2" && s.HookOrder == 10002)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.AfterStep && s.Method.Name == "AfterOrderTenThousandAnd3" && s.HookOrder == 10003)); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count( s => s.HookType == HookType.AfterTestRun && s.Method.Name == "AfterOrderTenThousandAnd4" && s.HookOrder == 10004)); }