Пример #1
0
        public void testSetttingSIF_ExtendedElements()
        {
            StudentPersonal sp = ObjectCreator.CreateStudentPersonal();

            sp.AddSIFExtendedElement("urn:foo", "bar");
            // Add another one with the same key
            sp.AddSIFExtendedElement("urn:foo", "bar2");
            // Add a hird one with a different key
            sp.AddSIFExtendedElement("urn:foo2", "bar3");

            SIF_ExtendedElement[] elementArray = sp.SIFExtendedElementsContainer.ToArray();
            Assert.AreEqual(2, elementArray.Length, "Should have two items in it.");

            // Try to find both elements to make sure that they are there
            bool found2 = false, found3 = false;

            for (int i = 0; i < 2; i++)
            {
                SIF_ExtendedElement test = elementArray[i];
                String key = test.Key;
                if (key.Equals("urn:foo"))
                {
                    String value = test.TextValue;
                    if (value.Equals("bar2"))
                    {
                        found2 = true;
                    }
                }
                else
                {
                    found3 = key.Equals("urn:foo2") && test.TextValue.Equals("bar3");
                }
            }
            Assert.IsTrue(found2, "Element2 was not found");
            Assert.IsTrue(found3, "Element3 was not found");
        }