Ejemplo n.º 1
0
        public void AddTest()
        {
            FileMARCXml target = new FileMARCXml();
            XDocument source = XDocument.Load("sandburg.xml");

            {
                int expected = 1;
                int actual;
                actual = target.Add(source);
                Assert.AreEqual(expected, actual);
            }

            {
                string expected = source.Elements().First(e => e.Name.LocalName == "collection").Elements().First(e => e.Name.LocalName == "record").ToString();
                string actual;
                actual = target.RawSource[0].ToString();
                Assert.AreEqual(expected, actual);
            }
        }
Ejemplo n.º 2
0
 public void RawSourceTest()
 {
     FileMARCXml target = new FileMARCXml();
     target.ImportMARCXml("sandburg.xml");
     string expected = XDocument.Load("sandburg.xml").Elements().First(e => e.Name.LocalName == "collection").Elements().First(e => e.Name.LocalName == "record").ToString();
     string actual;
     actual = target.RawSource[0].ToString();
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 3
0
 public void ResetTest()
 {
     FileMARCXml target = new FileMARCXml();
     target.ImportMARCXml("sandburg.xml");
     target.ImportMARCXml("bigarchive.xml");
     target.MoveNext();
     target.MoveNext();
     target.MoveNext();
     target.Reset();
     target.MoveNext();
     bool expected = true;
     bool actual;
     actual = target.MoveNext();
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 4
0
 public void ItemTest()
 {
     FileMARCXml target = new FileMARCXml();
     target.ImportMARCXml("sandburg.xml");
     int index = 0;
     Record recordAtIndex;
     recordAtIndex = target[index];
     string expected = "01142cam  2200301 a 4500001001300000003000400013005001700017008004100034010001700075020002500092040001800117042000900135050002600144082001600170100003200186245008600218250001200304260005200316300004900368500004000417520022800457650003300685650003300718650002400751650002100775650002300796700002100819   92005291 DLC19930521155141.9920219s1993    caua   j      000 0 eng    a   92005291   a0152038655 :c$15.95  aDLCcDLCdDLC  alcac00aPS3537.A618bA88 199300a811/.522201 aSandburg, Carl,d1878-1967.10aArithmetic /cCarl Sandburg ; illustrated as an anamorphic adventure by Ted Rand.  a1st ed.  aSan Diego :bHarcourt Brace Jovanovich,cc1993.  a1 v. (unpaged) :bill. (some col.) ;c26 cm.  aOne Mylar sheet included in pocket.  aA poem about numbers and their characteristics. Features anamorphic, or distorted, drawings which can be restored to normal by viewing from a particular angle or by viewing the image's reflection in the provided Mylar cone. 0aArithmeticxJuvenile poetry. 0aChildren's poetry, American. 1aArithmeticxPoetry. 1aAmerican poetry. 1aVisual perception.1 aRand, Ted,eill.";
     string actual;
     actual = recordAtIndex.ToRaw();
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 5
0
 public void GetEnumeratorTest()
 {
     FileMARCXml target = new FileMARCXml();
     IEnumerator actual;
     actual = target.GetEnumerator();
     Assert.IsInstanceOfType(actual, typeof(IEnumerator));
 }
Ejemplo n.º 6
0
        public void FileMARCXMLConstructorTest1()
        {
            string source = File.ReadAllText("sandburg.xml");
            FileMARCXml target = new FileMARCXml(source);

            {
                int expected = 1;
                int actual;
                actual = target.RawSource.Count;
                Assert.AreEqual(expected, actual);
            }

            {
                string expected = XDocument.Parse(source).Elements().First(e => e.Name.LocalName == "collection").Elements().First(e => e.Name.LocalName == "record").ToString();
                string actual;
                actual = target.RawSource[0].ToString();
                Assert.AreEqual(expected, actual);
            }
        }
Ejemplo n.º 7
0
 public void FileMARCXMLConstructorTest()
 {
     FileMARCXml target = new FileMARCXml();
     int expected = 0;
     int actual;
     actual = target.RawSource.Count;
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 8
0
 public void CountTest()
 {
     FileMARCXml target = new FileMARCXml();
     target.ImportMARCXml("sandburg.xml");
     target.ImportMARCXml("bigarchive.xml");
     int expected = 2;
     int actual;
     actual = target.Count;
     Assert.AreEqual(expected, actual);
 }