예제 #1
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);
        }
예제 #2
0
        public void HasField()
        {
            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);
            Assert.True(record.HasField(245));
            Assert.False(record.HasField(300));

            //test after a map
            record.MapField(245, 300);
            Assert.True(record.HasField(300));
            Assert.False(record.HasField(245));
        }