当前位置: 首页>>代码示例>>C#>>正文


C# XsltArgumentList.GetExtensionObject方法代码示例

本文整理汇总了C#中System.Xml.Xsl.XsltArgumentList.GetExtensionObject方法的典型用法代码示例。如果您正苦于以下问题:C# XsltArgumentList.GetExtensionObject方法的具体用法?C# XsltArgumentList.GetExtensionObject怎么用?C# XsltArgumentList.GetExtensionObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Xsl.XsltArgumentList的用法示例。


在下文中一共展示了XsltArgumentList.GetExtensionObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetExtObject7

        public void GetExtObject7()
        {
            m_xsltArg = new XsltArgumentList();
            String obj = "0.00";

            // string
            m_xsltArg.AddExtensionObject("myArg1", obj);
            retObj = m_xsltArg.GetExtensionObject("myArg1");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "0.00", retObj);
            if (retObj.ToString() != "0.00")
            {
                _output.WriteLine("Failed to add/get a value for {0} of type {1}", "0.00", "string");
                _output.WriteLine("Retrieved: {0}  ", retObj);
                Assert.True(false);
            }

            int i = 8;

            m_xsltArg.AddExtensionObject("myArg2", i);
            retObj = m_xsltArg.GetExtensionObject("myArg2");
            _output.WriteLine("Added Value:{0}\nRetrieved Value:{1}", i, retObj);
            if (!i.Equals(retObj))
            {
                _output.WriteLine("Failed to add/get a value for {0} with conversion from int to double", i);
                _output.WriteLine("Retrieved: {0}", retObj.ToString());
                Assert.True(false);
            }

            //must also be same instance!!!
            if (i != (int)retObj)
                Assert.True(false);

            Boolean bF = (1 == 0);

            m_xsltArg.AddExtensionObject("myArg3", bF);
            retObj = m_xsltArg.GetExtensionObject("myArg3");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bF.ToString(), retObj);
            if (!bF.Equals(retObj))
            {
                _output.WriteLine("Failed to add/get a value for {0} of type {1}", bF.ToString(), "boolean");
                _output.WriteLine("Retrieved: {0}  ", retObj);
                Assert.True(false);
            }

            Boolean bT = (1 == 1);

            m_xsltArg.AddExtensionObject("myArg4", bT);
            retObj = m_xsltArg.GetExtensionObject("myArg4");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bT.ToString(), retObj);
            if (!bT.Equals(retObj))
            {
                _output.WriteLine("Failed to add/get a value for {0} of type {1}", bT.ToString(), "boolean");
                _output.WriteLine("Retrieved: {0}  ", retObj);
                Assert.True(false);
            }
            return;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:57,代码来源:XsltArgumentList.cs

示例2: GetExtObject8

        public void GetExtObject8()
        {
            MyObject obj = new MyObject(8, _output);
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddExtensionObject("urn:my-object", obj);

            retObj = m_xsltArg.GetExtensionObject("urn:my-object");
            if (((MyObject)retObj).MyValue() != obj.MyValue())
            {
                _output.WriteLine("Set and retrieved value appear to be different");
                Assert.True(false);
            }

            retObj = m_xsltArg.GetExtensionObject("URN:MY-OBJECT");
            if (retObj != null)
            {
                _output.WriteLine("Set and retrieved value appear to be different for URN:MY-OBJECT");
                Assert.True(false);
            }

            retObj = m_xsltArg.GetExtensionObject("urn:My-Object");
            if (retObj != null)
            {
                _output.WriteLine("Set and retrieved value appear to be different for urn:My-Object");
                Assert.True(false);
            }

            retObj = m_xsltArg.GetExtensionObject("urn-my:object");
            if (retObj != null)
            {
                _output.WriteLine("Set and retrieved value appear to be different for urn-my:object");
                Assert.True(false);
            }

            string expXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result xmlns:myObj=\"urn:my-object\"><func1>1.Test1</func1><func2>2.Test2</func2><func3>3.Test3</func3></result>";
            if ((LoadXSL("MyObjectDef.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(expXml) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:42,代码来源:XsltArgumentList.cs

示例3: GetExtObject5

        public void GetExtObject5()
        {
            m_xsltArg = new XsltArgumentList();
            MyObject obj = new MyObject(5, _output);

            m_xsltArg.AddExtensionObject(szLongNS, obj);
            retObj = m_xsltArg.GetExtensionObject(szLongNS);

            if (((MyObject)retObj).MyValue() != obj.MyValue())
            {
                _output.WriteLine("Set and retrieved value appear to be different");
                Assert.True(false);
            }

            string expXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result xmlns:myObj=\"http://www.microsoft.com/this/is/a/very/long/namespace/uri/to/do/the/api/testing/for/xslt/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/\"><func1>1.Test1</func1><func2>2.Test2</func2><func3>3.Test3</func3></result>";
            if ((LoadXSL("MyObjectLongNS.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(expXml) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:21,代码来源:XsltArgumentList.cs

示例4: GetExtObject6

        public void GetExtObject6()
        {
            m_xsltArg = new XsltArgumentList();
            MyObject obj = new MyObject(6, _output);
            m_xsltArg.AddExtensionObject(szInvalid, obj);

            retObj = m_xsltArg.GetExtensionObject(szInvalid);

            Assert.True(retObj == obj);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:10,代码来源:XsltArgumentList.cs

示例5: AddExtObject8

        public void AddExtObject8()
        {
            string expected = @"<?xml version=""1.0"" encoding=""utf-8""?><result xmlns:myObj=""urn:my-object"">
		1.Test1
		2.Test2
		3.Test3</result>";

            MyObject obj = new MyObject(1, _output);
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddExtensionObject("urn:my-object", obj);

            retObj = m_xsltArg.GetExtensionObject("urn:my-object");
            if (((MyObject)retObj).MyValue() != obj.MyValue())
            {
                _output.WriteLine("Set and retrieved value appear to be different");
                Assert.True(false);
            }
            m_xsltArg.AddExtensionObject("URN:MY-OBJECT", obj);
            m_xsltArg.AddExtensionObject("urn:My-Object", obj);
            m_xsltArg.AddExtensionObject("urn-my:object", obj);

            if ((LoadXSL("myObjectDef.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(expected);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:chcosta,项目名称:corefx,代码行数:30,代码来源:CXslTArgumentList.cs

示例6: GetExtObject4

        public void GetExtObject4()
        {
            m_xsltArg = new XsltArgumentList();

            retObj = m_xsltArg.GetExtensionObject(szDefaultNS);

            if (retObj != null)
            {
                _output.WriteLine("Did not return a NULL value for a non-existent URI");
                Assert.True(false);
            }
            try
            {
                if ((LoadXSL("MyObjectDef.xsl") == 1))
                    Transform_ArgList("fruits.xml");
            }
            catch (System.Xml.Xsl.XsltException)
            {
                return;
            }
            _output.WriteLine("Did not throw exception for an invalid transform");
            Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:23,代码来源:XsltArgumentList.cs

示例7: Clear4

        public void Clear4()
        {
            MyObject obj = new MyObject(26, _output);
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddExtensionObject(szDefaultNS, obj);
            m_xsltArg.Clear();
            retObj = m_xsltArg.GetExtensionObject(szDefaultNS);
            if (retObj != null)
            {
                _output.WriteLine("Did not appear to clear an extension object");
                Assert.True(false);
            }

            if ((LoadXSL("MyObjectDef.xsl") == 1))
            {
                try
                {
                    Transform_ArgList("fruits.xml");
                }
                catch (System.Xml.Xsl.XsltException)
                {
                    return;
                }
            }
            _output.WriteLine("Exception not thrown for NS not found");
            Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:28,代码来源:XsltArgumentList.cs

示例8: GetExtObject11

        public void GetExtObject11()
        {
            MyObject obj = new MyObject(11, _output);
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddExtensionObject(szDefaultNS, obj);

            for (int i = 0; i < 500; i++)
            {
                retObj = m_xsltArg.GetExtensionObject(szDefaultNS);
                if (((MyObject)retObj).MyValue() != obj.MyValue())
                {
                    _output.WriteLine("Set and retrieved value appear to be different after {i} tries", i);
                    Assert.True(false);
                }
            }
            string expXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result xmlns:myObj=\"urn:my-object\"><func1>1.Test1</func1><func2>2.Test2</func2><func3>3.Test3</func3></result>";
            if ((LoadXSL("MyObjectDef.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(expXml) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:23,代码来源:XsltArgumentList.cs

示例9: AddExtObject31

        public void AddExtObject31()
        {
            MyObject obj = new MyObject(31, _output);
            m_xsltArg = new XsltArgumentList();
            ///nonePermSet.PermitOnly(); ;
            m_xsltArg.AddExtensionObject(szXslNS, obj);
            retObj = m_xsltArg.GetExtensionObject(szXslNS);
            ///CodeAccessPermission.RevertPermitOnly();

            Assert.Equal(retObj, obj);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:11,代码来源:XsltArgumentList.cs

示例10: RemoveExtObj8

        public void RemoveExtObj8()
        {
            int i = 1;
            m_xsltArg = new XsltArgumentList();
            ///nonePermSet.PermitOnly(); ;
            foreach (String str in szWhiteSpace)
            {
                MyObject obj = new MyObject(i, _output);

                m_xsltArg.AddExtensionObject(szDefaultNS + str, obj);
                m_xsltArg.RemoveExtensionObject(szDefaultNS + str);
                retObj = m_xsltArg.GetExtensionObject(szDefaultNS + str);
                if (retObj != null)
                {
                    _output.WriteLine("Error deleting case #{0} for whitespace arg", i);
                    Assert.True(false);
                }
                i++;
            }
            ///CodeAccessPermission.RevertPermitOnly();

            try
            {
                if ((LoadXSL("MyObjectDef.xsl") == 1))
                    Transform_ArgList("fruits.xml", true);
            }
            catch (System.Xml.Xsl.XsltException)
            {
                return;
            }
            _output.WriteLine("Did not exception for object that could not be executed");
            Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:33,代码来源:XsltArgumentList.cs

示例11: AddExtObject8

        public void AddExtObject8(object param)
        {
            MyObject obj = new MyObject(1, _output);
            m_xsltArg = new XsltArgumentList();
            string Baseline = "baseline\\" + (string)param;
            ///nonePermSet.PermitOnly(); ;
            m_xsltArg.AddExtensionObject("urn:my-object", obj);

            retObj = m_xsltArg.GetExtensionObject("urn:my-object");
            if (((MyObject)retObj).MyValue() != obj.MyValue())
            {
                _output.WriteLine("Set and retrieved value appear to be different");
                Assert.True(false);
            }
            m_xsltArg.AddExtensionObject("URN:MY-OBJECT", obj);
            m_xsltArg.AddExtensionObject("urn:My-Object", obj);
            m_xsltArg.AddExtensionObject("urn-my:object", obj);
            ///CodeAccessPermission.RevertPermitOnly();
            if ((LoadXSL("MyObjectDef.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1))
            {
                VerifyResult(Baseline, _strOutFile);
                return;
            }
            else
                Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:26,代码来源:XsltArgumentList.cs

示例12: AddExtObject8

        public void AddExtObject8()
        {
            MyObject obj = new MyObject(1, _output);
            m_xsltArg = new XsltArgumentList();

            m_xsltArg.AddExtensionObject("urn:my-object", obj);

            retObj = m_xsltArg.GetExtensionObject("urn:my-object");
            if (((MyObject)retObj).MyValue() != obj.MyValue())
            {
                _output.WriteLine("Set and retrieved value appear to be different");
                Assert.True(false);
            }
            m_xsltArg.AddExtensionObject("URN:MY-OBJECT", obj);
            m_xsltArg.AddExtensionObject("urn:My-Object", obj);
            m_xsltArg.AddExtensionObject("urn-my:object", obj);

            if ((LoadXSL("myObjectDef.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(430.402026847) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:23,代码来源:CXslTArgumentList.cs

示例13: AddExtObject6

        public void AddExtObject6()
        {
            m_xsltArg = new XsltArgumentList();
            String obj = "0.00";

            // string
            m_xsltArg.AddExtensionObject("myArg1", obj);
            retObj = m_xsltArg.GetExtensionObject("myArg1");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "0.00", retObj);
            if (retObj.ToString() != "0.00")
            {
                _output.WriteLine("Failed to add/get a value for {0} of type {1}", "0.00", "string");
                _output.WriteLine("Retrieved: {0}  ", retObj);
                Assert.True(false);
            }

            int i = 8;

            m_xsltArg.AddExtensionObject("myArg2", i);
            retObj = m_xsltArg.GetExtensionObject("myArg2");
            _output.WriteLine("Added Value:{0}\nRetrieved Value:{1}", i, retObj);
            if (!i.Equals(retObj))
            {
                _output.WriteLine("Failed to add/get a value for {0} with conversion from int to double", i);
                _output.WriteLine("Retrieved: {0}", retObj.ToString());
                Assert.True(false);
            }

            //must also be same instance!!!
            if (i != (int)retObj)
                Assert.True(false);

            Boolean bF = (1 == 0);

            m_xsltArg.AddExtensionObject("myArg3", bF);
            retObj = m_xsltArg.GetExtensionObject("myArg3");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bF.ToString(), retObj);
            if (!bF.Equals(retObj))
            {
                _output.WriteLine("Failed to add/get a value for {0} of type {1}", bF.ToString(), "boolean");
                _output.WriteLine("Retrieved: {0}  ", retObj);
                Assert.True(false);
            }

            Boolean bT = (1 == 1);

            m_xsltArg.AddExtensionObject("myArg4", bT);
            retObj = m_xsltArg.GetExtensionObject("myArg4");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bT.ToString(), retObj);
            if (!bT.Equals(retObj))
            {
                _output.WriteLine("Failed to add/get a value for {0} of type {1}", bT.ToString(), "boolean");
                _output.WriteLine("Retrieved: {0}  ", retObj);
                Assert.True(false);
            }

            double d = 3.14;

            m_xsltArg.AddExtensionObject("myArg5", d);
            retObj = m_xsltArg.GetExtensionObject("myArg5");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d.ToString(), retObj);
            if (!d.Equals(retObj))
            {
                _output.WriteLine("Failed to add/get a value for {0} of type {1}", bT.ToString(), "boolean");
                _output.WriteLine("Retrieved: {0}  ", retObj);
                Assert.True(false);
            }

            m_xsltArg.AddExtensionObject("myArg6", "3");
            retObj = m_xsltArg.GetExtensionObject("myArg6");
            _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bT.ToString(), retObj);

            if ((LoadXSL("MyObject_DataTypes.xsl") == 1) && (Transform_ArgList("fruits.xml") == 1) &&
                (CheckResult(499.4069850096) == 1))
                return;
            else
                Assert.True(false);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:78,代码来源:CXslTArgumentList.cs

示例14: GetExtObject9

        public void GetExtObject9()
        {
            int i = 1;
            m_xsltArg = new XsltArgumentList();

            foreach (String str in szWhiteSpace)
            {
                MyObject obj = new MyObject(i, _output);

                m_xsltArg.AddExtensionObject(szDefaultNS + str, obj);
                retObj = m_xsltArg.GetExtensionObject(szDefaultNS + str);
                if (((MyObject)retObj).MyValue() != i)
                {
                    _output.WriteLine("Error processing {0} test for whitespace arg", i);
                    Assert.True(false);
                }
                i++;
            }

            try
            {
                if ((LoadXSL("MyObjectDef.xsl") == 1))
                    Transform_ArgList("fruits.xml");
            }
            catch (System.Xml.Xsl.XsltException)
            {
                return;
            }
            _output.WriteLine("Did not throw expected exception: System.Xml.Xsl.XsltException");
            Assert.True(false);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:31,代码来源:XsltArgumentList.cs

示例15: GetExtObject2

        public void GetExtObject2()
        {
            m_xsltArg = new XsltArgumentList();

            try
            {
                m_xsltArg.GetExtensionObject(null);
            }
            catch (System.ArgumentNullException)
            {
                return;
            }
            _output.WriteLine("ArgumentNullException not thrown for null namespace System.Xml.Tests");
            return;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:15,代码来源:XsltArgumentList.cs


注:本文中的System.Xml.Xsl.XsltArgumentList.GetExtensionObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。