public void ShouldFindExampleConverter() { RuntimeBindingRegistryBuilder builder = new RuntimeBindingRegistryBuilder(bindingSourceProcessorStub); builder.BuildBindingsFromAssembly(Assembly.GetExecutingAssembly()); Assert.AreEqual(1, bindingSourceProcessorStub.StepArgumentTransformationBindings.Count(s => s.Regex != null && s.Regex.Match("BindingRegistryTests").Success && s.Regex.Match("").Success == false)); }
public void ShouldFindScopedExampleConverter() { RuntimeBindingRegistryBuilder builder = new RuntimeBindingRegistryBuilder(bindingSourceProcessorStub); builder.BuildBindingsFromAssembly(Assembly.GetExecutingAssembly()); Assert.AreEqual(2, bindingSourceProcessorStub.StepDefinitionBindings.Count(s => s.StepDefinitionType == StepDefinitionType.Then && s.Regex.Match("SpecificBindingRegistryTests").Success && s.IsScoped)); Assert.AreEqual(0, bindingSourceProcessorStub.StepDefinitionBindings.Count(s => s.StepDefinitionType == StepDefinitionType.Then && s.Regex.Match("SpecificBindingRegistryTests").Success && s.IsScoped == false)); }
public void ShouldFindScopedHook_WithScopeAttribute() { RuntimeBindingRegistryBuilder builder = new RuntimeBindingRegistryBuilder(bindingSourceProcessorStub); builder.BuildBindingsFromAssembly(Assembly.GetExecutingAssembly()); Assert.AreEqual(1, bindingSourceProcessorStub.HookBindings.Count(s => s.Method.Name == "Tag1BeforeScenario" && s.IsScoped)); }
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)); }
public void ShouldFindBinding_WithDefaultOrder() { var builder = new RuntimeBindingRegistryBuilder(bindingSourceProcessorStub); builder.BuildBindingsFromType(typeof (ScopedHookExample)); Assert.AreEqual(4, bindingSourceProcessorStub.HookBindings.Count(s => s.HookOrder == 10000)); }