示例#1
0
        public void should_be_able_to_read_inline_values_from_transformation_configuration()
        {
            //ARRANGE
            var configurationReader     = TransformConfgReaderTestFactory.CreateConfigReader("test.xml", @"
                            <root>
                                <transformationGroup pattern=""aaa.pattern.xml"">
                                    <transformation output=""output.xml"">
                                        <values>
                                            <Val1>AAA</Val1>
                                        </values>                                    
                                    </transformation>
                                </transformationGroup>
                            </root>");
            var transformConfigurations = configurationReader.ReadConfig("test.xml");
            var transformationToTest    = transformConfigurations.First();

            //ACT
            var values = transformationToTest.ValuesProvider.GetValues();


            //ASSERT
            Assert.IsNotNull(values);
            Assert.IsTrue(values.ContainsKey("Val1"));
            Assert.AreEqual(values["Val1"], "AAA");
        }
示例#2
0
        public void should_be_able_to_suppress_all_post_transformation_on_lower_level_of_configuration()
        {
            //ARRANGE
            var configurationReader = TransformConfgReaderTestFactory.CreateConfigReader("test.xml", @"
                            <root>
                                <postTransformations>
                                    <add name=""StripXMLComments"" />
                                    <add name=""ReFormatXML"" />
                                </postTransformations>
                                <transformationGroup pattern=""aaa.pattern.xml"">
                                    <transformation values=""aaa.values.xml"" output=""output.xml"">
                                        <postTransformations>
                                            <clear />
                                        </postTransformations>
                                    </transformation>
                                </transformationGroup>
                            </root>");

            //ACT
            var transformConfigurations = configurationReader.ReadConfig("test.xml");


            //ASSERT
            var transformationToTest = transformConfigurations.First();

            Assert.IsNotNull(transformationToTest.PostTransformations);
            Assert.AreEqual(0, transformationToTest.PostTransformations.Count);
        }
示例#3
0
        public void should_be_able_to_read_post_transformation_from_transformation_node_configuration()
        {
            //ARRANGE
            var configurationReader = TransformConfgReaderTestFactory.CreateConfigReader("test.xml", @"
                            <root>
                                <transformationGroup pattern=""aaa.pattern.xml"">
                                    <transformation values=""aaa.values.xml"" output=""output.xml"">
                                        <postTransformations>
                                            <add name=""ReFormatXML"" />
                                        </postTransformations>
                                    </transformation>
                                </transformationGroup>
                            </root>");

            //ACT
            var transformConfigurations = configurationReader.ReadConfig("test.xml");


            //ASSERT
            var transformationToTest = transformConfigurations.First();

            Assert.IsNotNull(transformationToTest.PostTransformations);
            Assert.AreEqual(1, transformationToTest.PostTransformations.Count);
            Assert.AreEqual("ReFormatXML", transformationToTest.PostTransformations.First().Name);
        }
示例#4
0
        public void should_be_to_use_alternative_syntax_for_values_with_key_attribute()
        {
            //ARRANGE
            var configurationReader     = TransformConfgReaderTestFactory.CreateConfigReader("test.xml", @"
                            <root>
                                <transformationGroup pattern=""aaa.pattern.xml"">
                                    <transformation valuesGroup=""SampleGroup"" output=""output.xml"">
                                        <values>
                                            <value key=""Val1"">AAA</value>
                                            <Val3>CCC</Val3>
                                        </values>
                                    </transformation>
                                </transformationGroup>
                                <valuesGroup name=""SampleGroup"">
                                    <value key=""Val1"">ZZZ</value>
                                    <value key=""Val2"">BBB</value>
                                </valuesGroup>
                            </root>");
            var transformConfigurations = configurationReader.ReadConfig("test.xml");
            var transformationToTest    = transformConfigurations.First();

            //ACT
            var values = transformationToTest.ValuesProvider.GetValues();


            //ASSERT
            Assert.IsNotNull(values);
            Assert.AreEqual(3, values.Count);
            Assert.AreEqual(values["Val1"], "AAA");
            Assert.AreEqual(values["Val2"], "BBB");
            Assert.AreEqual(values["Val3"], "CCC");
        }
示例#5
0
        public void should_be_able_to_read_many_transformation_for_single_pattern()
        {
            //ARRANGE
            var configurationReader = TransformConfgReaderTestFactory.CreateConfigReader("test.xml", @"
                            <root>
                                <transformationGroup pattern=""aaa.pattern.xml"">
                                    <transformation values=""aaa.values.xml"" output=""output.xml"" />
                                    <transformation values=""aaa1.values.xml"" output=""output1.xml"" />
                                </transformationGroup>
                            </root>");

            //ACT
            var result = configurationReader.ReadConfig("test.xml");

            //ASSERT
            Assert.IsNotNull(result);
            CollectionAssert.IsNotEmpty(result);
            Assert.AreEqual(2, result.Count);
        }
示例#6
0
        public void should_be_able_to_read_transformations_from_file()
        {
            //ARRANGE
            var configurationReader = TransformConfgReaderTestFactory.CreateConfigReader("test.xml", @"
                            <root>
                                <transformationGroup pattern=""aaa.pattern.xml"">
                                    <transformation values=""aaa.values.xml"" output=""output.xml"" />
                                </transformationGroup>
                            </root>");

            //ACT
            var result = configurationReader.ReadConfig("test.xml");

            //ASSERT
            Assert.IsNotNull(result);
            CollectionAssert.IsNotEmpty(result);
            Assert.AreEqual("aaa.pattern.xml", result[0].PatternFilePath);
            Assert.IsNotNull(result[0].ValuesProvider);
            Assert.AreEqual("output.xml", result[0].OutputFilePath);
        }