public void 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);
            TimeSpan duration;
            var      result = invoker.InvokeBinding(stepTransformationBinding, contextManagerStub.Object, new object[] { new Table("h1") }, new Mock <ITestTracer>().Object, out duration);

            Assert.NotNull(result);
            Assert.That(result.GetType(), Is.EqualTo(typeof(Table)));
            Assert.That(((Table)result).Header, Is.EqualTo(new string[] { "transformed column", "h1" }));
        }
        public void 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);
            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(string)));
            Assert.That(((string)result), Is.EqualTo("prefix xyz"));
        }
예제 #3
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");
        }
예제 #4
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" });
        }
예제 #5
0
        public void TypeToTypeConverterShouldConvertStringToStringUsingRegex()
        {
            TypeToTypeConverter stepTransformationInstance = new TypeToTypeConverter();
            var transformMethod           = stepTransformationInstance.GetType().GetMethod("StringToStringConvertRegex");
            var stepTransformationBinding = CreateStepTransformationBinding(@"string (\w+)", transformMethod);

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

            var      invoker = new BindingInvoker(ConfigurationLoader.GetDefault(), new Mock <IErrorProvider>().Object, new SynchronousBindingDelegateInvoker());
            TimeSpan duration;
            var      result = invoker.InvokeBinding(stepTransformationBinding, contextManagerStub.Object, new object[] { "xyz" }, new Mock <ITestTracer>().Object, out duration);

            Assert.NotNull(result);
            result.GetType().Should().Be <string>();
            result.Should().Be("prefix xyz");
        }