public void Setup() { bindingSourceProcessorStub = new BindingSourceProcessorStub(); }
public RuntimeBindingRegistryBuilderTests() { bindingSourceProcessorStub = new BindingSourceProcessorStub(); }
public void Non_static_method_with_non_scenario_specific_hook_should_not_be_valid() { var stubType = new BindingSourceType { IsGenericTypeDefinition = false, IsClass = true, IsAbstract = false, Attributes = new[] { bindingSourceAttribute, } }; var stubMethod = new BindingSourceMethod { IsPublic = true, IsStatic = false, BindingMethod = new BindingMethod(new BindingType("Test", "Test"), "TestMethod", Enumerable.Empty<IBindingParameter>(), new BindingType("Test", "Test")), Attributes = new[] { new BindingSourceAttribute { AttributeType = new RuntimeBindingType(typeof(BeforeTestRunAttribute)), NamedAttributeValues = new Dictionary<string, IBindingSourceAttributeValueProvider>(), AttributeValues = new IBindingSourceAttributeValueProvider[] { } }, new BindingSourceAttribute { AttributeType = new RuntimeBindingType(typeof(MethodBinding)) }, new BindingSourceAttribute { AttributeType = new RuntimeBindingType(typeof(StepDefinitionAttribute)), NamedAttributeValues = new Dictionary<string, IBindingSourceAttributeValueProvider>(), AttributeValues = new IBindingSourceAttributeValueProvider[] { } }, new BindingSourceAttribute { AttributeType = new RuntimeBindingType(typeof(ScopeAttribute)), NamedAttributeValues = new Dictionary<string, IBindingSourceAttributeValueProvider>(), AttributeValues = new IBindingSourceAttributeValueProvider[] { } }, } }; var bspStub = new BindingSourceProcessorStub(); // Process type must be called first to ensure the binding source processer is in the correct state bspStub.ProcessType(stubType); bspStub.ProcessMethod(stubMethod); Assert.AreEqual(0, bspStub.HookBindings.Count, "A non static method with a non scenario specific hook should not be valid"); }
public void Non_static_method_in_non_abstract_class_should_be_valid() { var stubType = new BindingSourceType { IsGenericTypeDefinition = false, IsClass = true, Attributes = new[] { this.bindingSourceAttribute, } }; var stubMethod = new BindingSourceMethod { IsPublic = true, IsStatic = false, BindingMethod = new BindingMethod(new BindingType("Test", "Test"), "TestMethod", Enumerable.Empty<IBindingParameter>(), new BindingType("Test", "Test")), Attributes = new[] { new BindingSourceAttribute { AttributeType = new RuntimeBindingType(typeof(MethodBinding)) }, new BindingSourceAttribute { AttributeType = new RuntimeBindingType(typeof(StepDefinitionAttribute)), NamedAttributeValues = new Dictionary<string, IBindingSourceAttributeValueProvider>(), AttributeValues = new IBindingSourceAttributeValueProvider[] {} }, new BindingSourceAttribute { AttributeType = new RuntimeBindingType(typeof(ScopeAttribute)), NamedAttributeValues = new Dictionary<string, IBindingSourceAttributeValueProvider>(), AttributeValues = new IBindingSourceAttributeValueProvider[] {}}, } }; var bspStub = new BindingSourceProcessorStub(); // Process type must be called first to ensure the binding source processer is in the correct state bspStub.ProcessType(stubType); bspStub.ProcessMethod(stubMethod); Assert.True(bspStub.StepDefinitionBindings.Count > 0, "A non static method in a non-abstract class should be valid"); }