public void WriteTest1() { string filename = "testwriter.mrc"; string expected = "01754cam 2200397 a 45000010009000000050017000090080041000269060045000679250044001129550187001560100017003430200034003600200037003940350023004310350020004540370060004740400049005340420009005830500024005920820014006161000018006302450070006482600038007183000029007565860037007855200280008226500038011026500034011406500031011746500031012056500029012366500025012656500022012906500022013126500022013341460273320110216094643.0061020s2007 nyua c 000 f eng a7bcbccorignewd1eecipf20gy-gencatlg0 aacquireb2 shelf copiesxpolicy default alb18 2006-10-20ilb18 2006-10-20elb18 2006-10-20 to CIPaps04 2007-05-17 1 copy rec'd., to CIP ver.fld11 2007-07-02 Z-CipVergld11 2007-07-02 to BCCDalf27 2007-07-11 cp. 2 to BCCD a 2006031847 a0810993139 (paper over board) a9780810993136 (paper over board) a(OCoLC)ocm74029165 a(OCoLC)74029165 bJunior Library Guildnhttp://www.juniorlibraryguild.com aDLCcDLCdBAKERdBTCTAdTEFdYDXCPdEHHdDLC alcac00aPZ7.K6232bDia 200700a[Fic]2221 aKinney, Jeff.10aDiary of a wimpy kid :bGreg Heffley's journal /cby Jeff Kinney. aNew York :bAmulet Books,cc2007. a217 p. :bill. ;c22 cm.8 aA Junior Library Guild selection aGreg records his sixth grade experiences in a middle school where he and his best friend, Rowley, undersized weaklings amid boys who need to shave twice daily, hope just to survive, but when Rowley grows more popular, Greg must take drastic measures to save their friendship. 0aMiddle schoolsvJuvenile fiction. 0aFriendshipvJuvenile fiction. 0aSchoolsvJuvenile fiction. 0aDiariesvJuvenile fiction. 1aMiddle schoolsvFiction. 1aFriendshipvFiction. 1aSchoolsvFiction. 1aDiariesvFiction. 1aHumorous stories."; string target1 = string.Empty; FileMARC marc = new FileMARC(expected); Record record = marc[0]; using (FileMARCWriter target = new FileMARCWriter(filename)) { target.Write(record); target.WriteEnd(); } Assert.IsTrue(File.Exists(filename)); using (FileMARCReader reader = new FileMARCReader(filename)) { foreach (Record rec in reader) { target1 = rec.ToRaw(); } } Assert.AreEqual(expected, target1); }
public void WriteTest() { string filename = "tworecords_onerda.mrc"; string writeFilename = "testwriter.mrc"; string target1 = null; string target2 = null; string expected1 = null; string expected2 = null; bool first = true; List <Record> records = new List <Record>(); using (FileMARCReader reader = new FileMARCReader(filename)) { foreach (Record record in reader) { if (first) { first = false; expected1 = record.ToRaw(); } else { expected2 = record.ToRaw(); } records.Add(record); } } using (FileMARCWriter target = new FileMARCWriter(writeFilename)) { target.Write(records); target.WriteEnd(); } Assert.IsTrue(File.Exists(filename)); first = true; using (FileMARCReader reader = new FileMARCReader(writeFilename)) { foreach (Record record in reader) { if (first) { first = false; target1 = record.ToRaw(); } else { target2 = record.ToRaw(); } } } Assert.AreEqual(expected1, target1); Assert.AreEqual(expected2, target2); Assert.IsTrue(expected1.Contains("©")); }
public void WriteEndTest() { string filename = "testwriter.mrc"; string expected = FileMARCWriter.END_OF_FILE.ToString(); using (FileMARCWriter target = new FileMARCWriter(filename)) { target.WriteEnd(); } string target1 = File.ReadAllText(filename); Assert.AreEqual(expected, target1); }