コード例 #1
0
        public void TakesUriAndResolver()
        {
            new TidyFileList(
                Path.Combine(Directory.GetCurrentDirectory(), "Test"),
                new MapOf(
                    new KeyValuePair <string, string>(
                        "first.xsl",
                        new TextOf(
                            new ResourceOf(
                                "Resources/first.xsl",
                                Assembly.GetExecutingAssembly()
                                )
                            ).AsString()
                        )
                    ),
                () =>
            {
                IXSL xsl =
                    new XSLDocument(
                        new Uri("file://" + Path.Combine(Directory.GetCurrentDirectory(), "Test/first.xsl")),
                        new SourcesEmbedded(
                            Assembly.GetExecutingAssembly(),
                            "Resources"
                            )
                        );

                Assert.Equal(
                    1,
                    xsl.Transformed(
                        new XMLCursor("<simple-test/>")
                        ).Nodes("/result[.=6]").Count
                    );
            }
                ).Invoke();
        }
コード例 #2
0
        public void TakesUri()
        {
            new TidyFileList(
                Path.Combine(Directory.GetCurrentDirectory(), "Test"),
                new MapOf(
                    new KeyValuePair <string, string>(
                        "demo.xsl",
                        new TextOf(
                            new ResourceOf(
                                "Resources/CreatesDone.xsl",
                                Assembly.GetExecutingAssembly()
                                )
                            ).AsString()
                        )
                    ),
                () =>
            {
                IXSL xsl =
                    new XSLDocument(
                        new Uri("file://" + Path.Combine(Directory.GetCurrentDirectory(), "Test/demo.xsl"))
                        );

                Assert.Equal(
                    1,
                    xsl.Transformed(
                        new XMLCursor("<a/>")
                        ).Nodes("/done").Count
                    );
            }
                ).Invoke();
        }
コード例 #3
0
        public void TakesITextResolverAndDictionary()
        {
            IXSL xsl =
                new XSLDocument(
                    new TextOf(
                        new ResourceOf(
                            "Resources/firstWithParam.xsl",
                            Assembly.GetExecutingAssembly()
                            )
                        ),
                    new SourcesEmbedded(
                        Assembly.GetExecutingAssembly(),
                        "Resources"
                        ),
                    new MapOf <object>(
                        new KeyValuePair <string, object>("faa", 9)
                        )
                    );

            Assert.Equal(
                1,
                xsl.Transformed(
                    new XMLCursor("<simple-test/>")
                    ).Nodes("/result/number[text() = 9]").Count
                );
        }
コード例 #4
0
        public void MakesXslTransformations(string xml)
        {
            IXSL xsl =
                new XSLDocument(
                    @"<xsl:stylesheet
                    xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
                    version='2.0'>
                    <xsl:template match='/'><done/>
                    </xsl:template></xsl:stylesheet>"
                    );

            Assert.Equal(
                1,
                xsl.Transformed(new XMLCursor(xml)).Nodes("/done").Count
                );
        }
コード例 #5
0
        public void TakesIInput()
        {
            var xsl =
                new XSLDocument(
                    new ResourceOf(
                        "Resources/CreatesDone.xsl",
                        Assembly.GetExecutingAssembly()
                        )
                    );

            Assert.Equal(
                1,
                xsl.Transformed(
                    new XMLCursor("<a/>")
                    ).Nodes("/done").Count
                );
        }
コード例 #6
0
        public void TakesStringAndResolver()
        {
            IXSL xsl =
                new XSLDocument(
                    new TextOf(
                        new ResourceOf(
                            "Resources/first.xsl",
                            Assembly.GetExecutingAssembly()
                            )
                        ).AsString(),
                    new SourcesEmbedded(
                        Assembly.GetExecutingAssembly(),
                        "Resources"
                        )
                    );

            Assert.Equal(
                1,
                xsl.Transformed(
                    new XMLCursor("<simple-test/>")
                    ).Nodes("/result[.=6]").Count
                );
        }