예제 #1
0
        public async Task TypeToTypeConverterShouldConvertStringToString()
        {
            TypeToTypeConverter stepTransformationInstance = new TypeToTypeConverter();
            var transformMethod           = stepTransformationInstance.GetType().GetMethod("StringToStringConvert");
            var stepTransformationBinding = CreateStepTransformationBinding(@"", transformMethod);

            var invoker = new BindingInvoker(ConfigurationLoader.GetDefault(), new Mock <IErrorProvider>().Object, new BindingDelegateInvoker());

            var(result, _) = await invoker.InvokeBindingAsync(stepTransformationBinding, contextManagerStub.Object, new object[] { "xyz" }, new Mock <ITestTracer>().Object);

            Assert.NotNull(result);
            result.GetType().Should().Be <string>();
            result.Should().Be("prefix xyz");
        }
예제 #2
0
        public async Task TypeToTypeConverterShouldConvertTableToTable()
        {
            TypeToTypeConverter stepTransformationInstance = new TypeToTypeConverter();
            var transformMethod           = stepTransformationInstance.GetType().GetMethod("TableToTableConvert");
            var stepTransformationBinding = CreateStepTransformationBinding(@"", transformMethod);

            var invoker = new BindingInvoker(ConfigurationLoader.GetDefault(), new Mock <IErrorProvider>().Object, new BindingDelegateInvoker());

            var(result, _) = await invoker.InvokeBindingAsync(stepTransformationBinding, contextManagerStub.Object, new object[] { new Table("h1") }, new Mock <ITestTracer>().Object);

            Assert.NotNull(result);

            result.GetType().Should().Be <Table>();
            ((Table)result).Header.Should().BeEquivalentTo(new string[] { "transformed column", "h1" });
        }
예제 #3
0
        public async Task UserConverterShouldConvertStringToUser()
        {
            UserCreator stepTransformationInstance = new UserCreator();
            var         transformMethod            = stepTransformationInstance.GetType().GetMethod("Create");
            var         stepTransformationBinding  = CreateStepTransformationBinding(@"user (\w+)", transformMethod);

            stepTransformationBinding.Regex.IsMatch("user xyz").Should().BeTrue();

            var invoker = new BindingInvoker(ConfigurationLoader.GetDefault(), new Mock <IErrorProvider>().Object, new BindingDelegateInvoker());

            var(result, _) = await invoker.InvokeBindingAsync(stepTransformationBinding, contextManagerStub.Object, new object[] { "xyz" }, new Mock <ITestTracer>().Object);

            Assert.NotNull(result);
            result.Should().BeOfType <User>();
            ((User)result).Name.Should().Be("xyz");
        }