Ejemplo n.º 1
0
 public BindingInvoker(RuntimeConfiguration runtimeConfiguration,
                       IErrorProvider errorProvider,
                       IHookRegistry hookRegistry)
 {
     _hookRegistry  = hookRegistry;
     _targetInvoker = new TechTalk.SpecFlow.Bindings.BindingInvoker(runtimeConfiguration, errorProvider);
 }
        public void UserConverterShouldConvertStringToUser()
        {
            UserCreator stepTransformationInstance = new UserCreator();
            var transformMethod = stepTransformationInstance.GetType().GetMethod("Create");
            var stepTransformationBinding = CreateStepTransformationBinding(@"user (\w+)", transformMethod);

            Assert.True(stepTransformationBinding.Regex.IsMatch("user xyz"));

            var invoker = new BindingInvoker(new RuntimeConfiguration(), new Mock<IErrorProvider>().Object);
            TimeSpan duration;
            var result = invoker.InvokeBinding(stepTransformationBinding, contextManagerStub.Object, new object[] { "xyz" }, new Mock<ITestTracer>().Object, out duration);
            Assert.NotNull(result);
            Assert.That(result.GetType(), Is.EqualTo(typeof(User)));
            Assert.That(((User)result).Name, Is.EqualTo("xyz"));
        }