예제 #1
0
        public void MARCMakerFormat()
        {
            string answer = @"=LDR  01201nam  2200253 a 4500
=001  tes96000001\
=003  ViArRB
=005  199602210153555.7
=008  960221s1955\\\\dcuabcdjdbkoqu001\0deng\d
=040  \\$aViArRB$cViArRB
=050  \4$aPQ1234$b.T39 1955
=100  2\$aDeer-Doe, J.$q(Jane),$csaint,$d1355-1401,$cspirit.
=245  10$aNew test record number 1 with ordinary data$h[large print] /$cby Jane Deer-Doe ; edited by Patty O'Furniture.
=246  1\$aNew test record number one with ordinary data
=260  \\$aWashington, DC :$bLibrary of Congress,$c1955-<1957>
=300  \\$av. 1-<5> :$bill., maps, ports., charts ;$c cm.
=440  \0$aTest record series ;$vno. 1
=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.
=500  \\$aThis is a test for the conversion of curly braces; the opening curly brace ({lcub}) and the closing curly brace ({rcub}).
=504  \\$aIncludes Bibliographies, discographies, filmographies, and reviews.
=500  \\$aIncludes index.
=650  \4$aTest record$xJuvenile.
=600  14$aDoe, John,$d1955- $xBiography.
=700  1\$aO'Furniture, Patty,$eed." + "\r\n\r\n";

            string answer2 = @"=LDR  02665nam  2200229 a 4500
=001  tes96000002\
=003  ViArRB
=005  19960221075055.7
=008  960221s1955\\\\dcuabcdjdbkoqu001\0dspa\d
=020  \\$a8472236579
=040  \\$aViArRB$cViArRB
=050  \4$aPQ1234$b.T39 1955
=100  2\$aDeer-Doe, Jane,$d1957-
=245  10$aNew test record number 2 with currently defined ANSEL characters (mostly diacritics) input with their real hexadecimal values$h[large print] /$cby Jane Deer-Doe
=260  \\$aWashington, DC :$bLibrary of Congress,$c1955.
=300  \\$a300 p. :$bill., maps, ports., charts ;$c cm.
=440  \0$aTest record series ;$vno. 2
=500  \\$aThis is a test of diacritics like the uppercase Polish L in {Lstrok}{acute}od{acute}z, the uppercase Scandinavia O in {Ostrok}st, the uppercase D with crossbar in {Dstrok}uro, the uppercase Icelandic thorn in {THORN}ann, the uppercase digraph AE in {AElig}gir, the uppercase digraph OE in {OElig}uvres, the soft sign in rech{softsign}, the middle dot in col{middot}lecci{acute}o, the musical flat in F{flat}, the patent mark in Frizbee{reg}, the plus or minus sign in {plusmn}54%, the uppercase O-hook in B{Ohorn}, the uppercase U-hook in X{Uhorn}A, the alif in mas{mlrhring}alah, the ayn in {mllhring}arab, the lowercase Polish l in W{lstrok}oc{lstrok}aw, the lowercase Scandinavian o in K{ostrok}benhavn, the lowercase d with crossbar in {dstrok}avola, the lowercase Icelandic thorn in {thorn}ann, the lowercase digraph ae in v{aelig}re, the lowercase digraph oe in c{oelig}ur, the lowercase hardsign in s{hardsign}ezd, the Turkish dotless i in masal{inodot}, the British pound sign in {pound}5.95, the lowercase eth in ver{eth}ur, the lowercase o-hook (with pseudo question mark) in S{hooka}{ohorn}, the lowercase u-hook in T{uhorn} D{uhorn}c, the pseudo question mark in c{hooka}ui, the grave accent in tr{grave}es, the acute accent in d{acute}esir{acute}ee, the circumflex in c{circ}ote, the tilde in ma{tilde}nana, the macron in T{macr}okyo, the breve in russki{breve}i, the dot above in {dot}zaba, the dieresis (umlaut) in L{uml}owenbr{uml}au, the caron (hachek) in {caron}crny, the circle above (angstrom) in {ring}arbok, the ligature first and second halves in d{llig}i{rlig}ad{llig}i{rlig}a, the high comma off center in rozdel{rcommaa}ovac, the double acute in id{dblac}oszaki, the candrabindu (breve with dot above) in Ali{candra}iev, the cedilla in {cedil}ca va comme {cedil}ca, the right hook in viet{ogon}a, the dot below in te{dotb}da, the double dot below in {under}k{under}hu{dbldotb}tbah, the circle below in Sa{dotb}msk{ringb}rta, the double underscore in {dblunder}Ghulam, the left hook in Lech Wa{lstrok}{commab}esa, the right cedilla (comma below) in kh{rcedil}ong, the upadhmaniya (half circle below) in {breveb}humantu{caron}s, double tilde, first and second halves in {ldbltil}n{rdbltil}galan, high comma (centered) in g{commaa}eotermika
=504  \\$aIncludes Bibliographies, discographies, filmographies, and reviews.
=500  \\$aIncludes index.
=650  \4$aTest record$xJuvenile.
=600  14$aDoe, John,$d1955- $xBiography." + "\r\n\r\n";


            TextReader marcRecord       = new StreamReader(@"C:\Documents and Settings\wkurt\My Documents\Visual Studio 2008\Projects\TestMARC\TestMARC\makrtest.mrc", Encoding.Default);
            string     marcTransmission = marcRecord.ReadToEnd();
            string     record2          = marcTransmission.Split(MARCConstants.END_OF_RECORD)[1];

            MARCRecord testRecord = new MARCRecord(marcTransmission);

            Assert.Equals(answer, testRecord.MARCMakerFormat());

            MARCRecord testRecord2 = new MARCRecord(record2);

            StringReader resultStream = new StringReader(testRecord2.MARCMakerFormat());
            StringReader answerStream = new StringReader(answer2);

            while (resultStream.Peek() != -1 && answerStream.Peek() != -1)
            {
                string answerLine = answerStream.ReadLine();
                string resultLine = resultStream.ReadLine();
                Assert.Equals(answerLine, resultLine, CharDiff(answerLine, resultLine));
            }
        }
예제 #2
0
 public override void Write(MARCRecord record)
 {
     fileStream.Write(record.MARCMakerFormat());
 }