コード例 #1
0
        public void testCustomFunction()
        {
            SIF_ZoneStatus  zoneStatus = createZoneStatus();
            SifXPathContext context    = SifXPathContext.NewSIFContext(zoneStatus, SifVersion.SIF20);
            object          value      =
                context.GetValue(
                    "adk:toLowerCase(SIF_Providers/SIF_Provider[SIF_ObjectList/SIF_Object[@ObjectName='SchoolInfo']]/@SourceId)");

            Assert.AreEqual("acmeagent", value, "Value");
        }
コード例 #2
0
        public void testGetValue()
        {
            SIF_ZoneStatus  zoneStatus = createZoneStatus();
            SifXPathContext context    = SifXPathContext.NewSIFContext(zoneStatus, SifVersion.SIF20);
            object          value      =
                context.GetValue(
                    "SIF_Providers/SIF_Provider[SIF_ObjectList/SIF_Object[@ObjectName='SchoolInfo']]/@SourceId");

            Assert.AreEqual("AcmeAgent", value.ToString(), "Value");
        }
コード例 #3
0
        private void assertByXPath(SifXPathContext context, String xPath,
                                   String assertedValue)
        {
            Element e = (Element)context.GetValue(xPath);

            Assertion.AssertNotNull("Field is null for path " + xPath, e);
            SifSimpleType value = e.SifValue;

            Assertion.AssertNotNull("Value is null for path " + xPath, value);
            Assertion.AssertEquals(xPath, assertedValue, value.ToString());
        }
コード例 #4
0
        public void testGetValueSubstring()
        {
            SIF_ZoneStatus zoneStatus = createZoneStatus();

            Console.WriteLine(zoneStatus.ToXml());

            SifXPathContext context = SifXPathContext.NewSIFContext(zoneStatus, SifVersion.SIF20);
            Object          value   =
                context.GetValue(
                    "substring(SIF_Providers/SIF_Provider[SIF_ObjectList/SIF_Object[@ObjectName='SchoolInfo']]/@SourceId, 5)");

            Assert.AreEqual("Agent", value, "Value");
        }
コード例 #5
0
        public void testCourseCodeSIF15r1()
        {
            Adk.SifVersion = SifVersion.SIF15r1;
            SchoolCourseInfo sci = new SchoolCourseInfo();

            sci.SetCourseCredits(CreditType.C0108_0585, 2);

            SifXPathContext spc   = SifXPathContext.NewSIFContext(sci);
            Element         value = (Element)spc.GetValue("CourseCredits[@Code='0585']");

            SifSimpleType elementValue = value.SifValue;

            Assertion.AssertNotNull("Value by XPath", elementValue);
            Assertion.AssertEquals("Value By XPath", 2, elementValue.RawValue);
        }