예제 #1
0
        public void GetField()
        {
            MARCRecord record = new MARCRecord();

            int tag1 = 650;

            string[] indicators1 = new string[2] {
                "", "0"
            };
            List <string> subfields1 = new List <string> {
                "a", "Pogramming Language"
            };
            MARCField subject1 = new MARCField(tag1, indicators1, subfields1, "");

            int tag2 = 650;

            string[] indicators2 = new string[2] {
                "", "0"
            };
            List <string> subfields2 = new List <string> {
                ""
            };
            MARCField subject2 = new MARCField(tag2, indicators2, subfields2, "");

            record.AddFields(new MARCField[2] {
                subject1, subject2
            });
            MARCField[] found = record.GetField(650);
            Assert.Equals(found[0], subject1);
            Assert.Equals(found[1], subject2);
        }
예제 #2
0
        public void DecodeMARC()
        {
            TextReader marcRecord       = new StreamReader(@"C:\Documents and Settings\wkurt\My Documents\Visual Studio 2008\Projects\TestMARC\TestMARC\makrtest.mrc");
            string     marcTransmission = marcRecord.ReadToEnd();

            MARCRecord testRecord = new MARCRecord(marcTransmission);//decode should happen automatically here

            Assert.Equals("4", testRecord.GetField(50)[0].Indicator2);

            Assert.Equals(@"=008  960221s1955\\\\dcuabcdjdbkoqu001\0deng\d", testRecord.GetField(8)[0].ToString());
            //Assert.Equals(@"=050  \4$aPQ1234$b.T39 1955", testRecord.GetField(50)[0].ToString());
            Assert.Equals(@"=260  \\$aWashington, DC :$bLibrary of Congress,$c1955-<1957>", testRecord.GetField(260)[0].ToString());
            Assert.Equals(@"=040  \\$aViArRB$cViArRB", testRecord.GetField(40)[0].ToString());
            Assert.Equals(@"=600  14$aDoe, John,$d1955- $xBiography.", testRecord.GetField(600)[0].ToString());

            marcRecord.Close();
        }
예제 #3
0
        public void MapField()
        {
            //test the case of 1:1 mapping
            int tag = 245;

            string[] indicators = new string[2] {
                "1", "0"
            };
            List <string> subfields = new List <string> {
                "a", "Python", "c", "Guido"
            };
            MARCField  newField = new MARCField(tag, indicators, subfields, "");
            MARCRecord record   = new MARCRecord();

            record.AddField(newField);
            record.MapField(245, 300);
            Assert.Equals(0, record.GetField(245).Length);
            Assert.Equals(1, record.GetField(300).Length);
        }
예제 #4
0
        //testing to make sure that once a record is created
        //all of the fields are printing right
        public void FieldsTest()
        {
            TextReader marcRecord       = new StreamReader(@"C:\Documents and Settings\wkurt\My Documents\Visual Studio 2008\Projects\TestMARC\TestMARC\makrtest.mrc");
            string     marcTransmission = marcRecord.ReadToEnd();

            MARCRecord testRecord = new MARCRecord(marcTransmission);

            Assert.Equals(@"=LDR  01201nam  2200253 a 4500", testRecord.FormatedLeader);
            Assert.Equals(@"=001  tes96000001\", testRecord.GetField(1)[0].ToString());
            Assert.Equals(@"=003  ViArRB", testRecord.GetField(3)[0].ToString());
            Assert.Equals(@"=005  199602210153555.7", testRecord.GetField(5)[0].ToString());
            Assert.Equals(@"=008  960221s1955\\\\dcuabcdjdbkoqu001\0deng\d", testRecord.GetField(8)[0].ToString());
            Assert.Equals(@"=040  \\$aViArRB$cViArRB", testRecord.GetField(40)[0].ToString());
            Assert.Equals(@"=050  \4$aPQ1234$b.T39 1955", testRecord.GetField(50)[0].ToString());
            Assert.Equals(@"=100  2\$aDeer-Doe, J.$q(Jane),$csaint,$d1355-1401,$cspirit.", testRecord.GetField(100)[0].ToString());
            Assert.Equals(@"=245  10$aNew test record number 1 with ordinary data$h[large print] /$cby Jane Deer-Doe ; edited by Patty O'Furniture.", testRecord.GetField(245)[0].ToString());
            Assert.Equals(@"=246  1\$aNew test record number one with ordinary data", testRecord.GetField(246)[0].ToString());
            Assert.Equals(@"=260  \\$aWashington, DC :$bLibrary of Congress,$c1955-<1957>", testRecord.GetField(260)[0].ToString());
            Assert.Equals(@"=300  \\$av. 1-<5> :$bill., maps, ports., charts ;$c cm.", testRecord.GetField(300)[0].ToString());
            Assert.Equals(@"=440  \0$aTest record series ;$vno. 1", testRecord.GetField(440)[0].ToString());
            Assert.Equals(@"=500  \\$aThis is a test of ordinary features like replacement of the mnemonics for currency and dollar signs and backslashes (backsolidus \) used for blanks in certain areas.", testRecord.GetField(500)[0].ToString());
            Assert.Equals(@"=500  \\$aThis is a test for the conversion of curly braces; the opening curly brace ({) and the closing curly brace (}).", testRecord.GetField(500)[1].ToString());
            Assert.Equals(@"=504  \\$aIncludes Bibliographies, discographies, filmographies, and reviews.", testRecord.GetField(504)[0].ToString());
            Assert.Equals(@"=500  \\$aIncludes index.", testRecord.GetField(500)[2].ToString());
            Assert.Equals(@"=650  \4$aTest record$xJuvenile.", testRecord.GetField(650)[0].ToString());
            Assert.Equals(@"=600  14$aDoe, John,$d1955- $xBiography.", testRecord.GetField(600)[0].ToString());
            Assert.Equals(@"=700  1\$aO'Furniture, Patty,$eed.", testRecord.GetField(700)[0].ToString());
        }