Пример #1
0
        public void XMLRecordfactoryMethodSuccesfulInstantiation()
        {
            fillTestIDList();
            XMLRecord testRec = XMLRecord.XMLRecordFactory(testIDList, "<XML>Not really XML</XML>", XMLDecl, "<nsTag xmlns:hpg=\"some namespace\">", "</endNSTag>");
            // Test IDs
            int i = 0;

            foreach (string ID in testRec.getIDList())
            {
                i++;
                Assert.AreEqual(ID, i.ToString());
            }
            //TestXMLRecord??
            //test XMLDecl
            testRec.MustBeValidatable = true;
            TestRegEx(true, testRec.getXMLRecord(), XMLDeclTestPattern);

            //namespaceTag
            TestRegEx(true, testRec.NamespaceTag, nsTagTestPattern);

            //namespace end tag
            TestRegEx(true, testRec.EndNamespaceTag, nsEndTagTestPattern);

            Assert.IsTrue(!testRec.SearchOnly);
        }
Пример #2
0
        public void XMLRecordfactoryMethodAllArgsAreNull()
        {
            fillTestIDList();
            int i = 0;

            for (int c = 0; c < testIDs.Length; c++)
            {
                try
                {
                    XMLRecord testRec = null;
                    i++;
                    switch (i + 1)
                    {
                    case 1:
                        testRec = XMLRecord.XMLRecordFactory(null, null, null, null, null);
                        break;

                    case 2:
                        testRec = XMLRecord.XMLRecordFactory(testIDList, null, null, null, null);
                        break;

                    case 3:
                        testRec = XMLRecord.XMLRecordFactory(testIDList, "<XML>Not really XML</XML>", null, null, null);
                        break;

                    case 4:
                        testRec = XMLRecord.XMLRecordFactory(testIDList, "<XML>Not really XML</XML>", XMLDecl, null, null);
                        break;

                    case 5:
                        testRec = XMLRecord.XMLRecordFactory(testIDList, "<XML>Not really XML</XML>", XMLDecl, "nsTag", null);
                        break;
                    }
                }
                catch (Exception e)
                {
                    Assert.IsInstanceOfType(e, typeof(ArgumentException));
                    Assert.AreEqual(errMsgs[i], e.Message);
                }
            }
        }