public void StepArgumentTypeConverterShouldUseUserConverterForConversion() { UserCreator stepTransformationInstance = new UserCreator(); var transformMethod = new RuntimeBindingMethod(stepTransformationInstance.GetType().GetMethod("Create")); var stepTransformationBinding = CreateStepTransformationBinding(@"user (\w+)", transformMethod); stepTransformations.Add(stepTransformationBinding); TimeSpan duration; var resultUser = new User(); methodBindingInvokerStub.Setup(i => i.InvokeBinding(stepTransformationBinding, It.IsAny<IContextManager>(), It.IsAny<object[]>(), It.IsAny<ITestTracer>(), out duration)) .Returns(resultUser); var stepArgumentTypeConverter = CreateStepArgumentTypeConverter(); var result = stepArgumentTypeConverter.Convert("user xyz", typeof(User), new CultureInfo("en-US")); Assert.That(result, Is.EqualTo(resultUser)); }
public void ShouldUseStepArgumentTransformationToConvertTable() { var table = new Table("Name"); UserCreator stepTransformationInstance = new UserCreator(); var transformMethod = new RuntimeBindingMethod(stepTransformationInstance.GetType().GetMethod("CreateUsers")); var stepTransformationBinding = CreateStepTransformationBinding(@"", transformMethod); stepTransformations.Add(stepTransformationBinding); TimeSpan duration; var resultUsers = new User[3]; methodBindingInvokerStub.Setup(i => i.InvokeBinding(stepTransformationBinding, It.IsAny<IContextManager>(), new object[] { table }, It.IsAny<ITestTracer>(), out duration)) .Returns(resultUsers); var stepArgumentTypeConverter = CreateStepArgumentTypeConverter(); var result = stepArgumentTypeConverter.Convert(table, typeof(IEnumerable<User>), new CultureInfo("en-US")); Assert.That(result, Is.Not.Null); Assert.That(result, Is.EqualTo(resultUsers)); }
protected bool Equals(RuntimeBindingMethod other) { return Equals(MethodInfo, other.MethodInfo); }
protected bool Equals(RuntimeBindingMethod other) { return(Equals(MethodInfo, other.MethodInfo)); }