public void MarcRecordUtility_SetSubField_4()
        {
            MarcRecord record = new MarcRecord();
            MarcRecord result = record.SetSubField(700, 1, 'a', 1, "Сидоров");

            Assert.AreSame(record, result);
            Assert.AreEqual(0, record.Fields.Count);
        }
        public void MarcRecordUtility_SetSubField_1()
        {
            MarcRecord record = new MarcRecord();
            MarcRecord result = record.SetSubField(700, 'a', "Сидоров");

            Assert.AreSame(record, result);
            Assert.AreEqual(1, record.Fields.Count);
            Assert.AreEqual(1, record.Fields[0].SubFields.Count);
            Assert.AreEqual('a', record.Fields[0].SubFields[0].Code);
            Assert.AreEqual("Сидоров", record.Fields[0].SubFields[0].Value);
        }
        public void MarcRecordUtility_SetSubField_6()
        {
            MarcRecord record = new MarcRecord();

            record.AddField(700, "^aИванов^bИ. И.");
            MarcRecord result = record.SetSubField(700, 1, 'a', 1, "Сидоров");

            Assert.AreSame(record, result);
            Assert.AreEqual(1, record.Fields.Count);
            Assert.AreEqual(2, record.Fields[0].SubFields.Count);
            Assert.AreEqual("Иванов", record.Fields[0].SubFields[0].Value);
        }
Exemple #4
0
        private static void DoFormat
        (
            object arg
        )
        {
            try
            {
                RecordTask taskInfo = (RecordTask)arg;
                using (IrbisConnection client = new IrbisConnection())
                {
                    client.ParseConnectionString(ConnectionString);
                    client.Connect();

                    MarcRecord targetRecord = Fst.Execute
                                              (
                        client,
                        taskInfo.Record
                                              );
                    if (targetRecord != null)
                    {
                        targetRecord.SetSubField(463, 'w', taskInfo.CurrentIssue);
                        targetRecord.SetSubField(463, 'c', taskInfo.Magazine.Title);

                        lock (SyncRoot)
                        {
                            RecordCount++;
                            //Buffer.Append(targetRecord);
                            client.WriteRecord(targetRecord, false, true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLogLine("EXCEPTION: {0}", ex);
            }
        }
        public void MarcRecordUtility_SetSubField_8()
        {
            MarcRecord record = new MarcRecord();

            record.AddField(700, "^aИванов^bИ. И.^aСнова Иванов^bСнова И. И.");
            record.AddField(700, "^aПетров^bП. П.^aСнова Петров^bСнова П. П.");
            MarcRecord result = record.SetSubField(700, 1, 'a', 1, "Сидоров");

            Assert.AreSame(record, result);
            Assert.AreEqual(2, record.Fields.Count);
            Assert.AreEqual(4, record.Fields[1].SubFields.Count);
            Assert.AreEqual("Петров", record.Fields[1].SubFields[0].Value);
            Assert.AreEqual("П. П.", record.Fields[1].SubFields[1].Value);
            Assert.AreEqual("Сидоров", record.Fields[1].SubFields[2].Value);
            Assert.AreEqual("Снова П. П.", record.Fields[1].SubFields[3].Value);
        }
        public void MarcRecordUtility_SetSubField_3()
        {
            MarcRecord record = new MarcRecord();

            record.AddField(700, "^aИванов^bИ. И.");
            record.AddField(700, "^aПетров^bП. П.");
            MarcRecord result = record.SetSubField(700, 'a', "Сидоров");

            Assert.AreSame(record, result);
            Assert.AreEqual(2, record.Fields.Count);
            Assert.AreEqual(2, record.Fields[0].SubFields.Count);
            Assert.AreEqual('a', record.Fields[0].SubFields[0].Code);
            Assert.AreEqual("Сидоров", record.Fields[0].SubFields[0].Value);
            Assert.AreEqual('b', record.Fields[0].SubFields[1].Code);
            Assert.AreEqual("И. И.", record.Fields[0].SubFields[1].Value);
            Assert.AreEqual(2, record.Fields[1].SubFields.Count);
            Assert.AreEqual("Петров", record.Fields[1].SubFields[0].Value);
        }