Example #1
0
        public void BatchRecordFormatter_FormatAll_1()
        {
            string database                    = "IBIS";
            int    batchSize                   = 500;
            string format                      = "Format";
            Mock <IIrbisConnection> mock       = GetMock();
            IIrbisConnection        connection = mock.Object;
            BatchRecordFormatter    batch
                = (BatchRecordFormatter)BatchRecordFormatter.Interval
                  (
                      connection,
                      database,
                      format,
                      1,
                      3,
                      batchSize
                  );
            List <string> formatted = batch.FormatAll();

            Assert.AreEqual(3, batch.RecordsFormatted);
            Assert.AreEqual(3, formatted.Count);
            Assert.AreEqual("Format IBIS 1", formatted[0]);
            Assert.AreEqual("Format IBIS 2", formatted[1]);
            Assert.AreEqual("Format IBIS 3", formatted[2]);

            mock.Verify(c => c.GetMaxMfn(It.IsAny <string>()), Times.Once);
            mock.Verify(c => c.FormatRecords(It.IsAny <string>(),
                                             It.IsAny <string>(), It.IsAny <IEnumerable <int> >()),
                        Times.Once);
        }
Example #2
0
        public void BatchRecordFormatter_Interval_1()
        {
            string database                    = "IBIS";
            int    batchSize                   = 500;
            string format                      = "Format";
            Mock <IIrbisConnection> mock       = GetMock();
            IIrbisConnection        connection = mock.Object;
            BatchRecordFormatter    batch
                = (BatchRecordFormatter)BatchRecordFormatter.Interval
                  (
                      connection,
                      database,
                      format,
                      1,
                      3,
                      batchSize
                  );

            Assert.AreSame(connection, batch.Connection);
            Assert.AreSame(database, batch.Database);
            Assert.AreSame(format, batch.Format);
            Assert.AreEqual(batchSize, batch.BatchSize);
            Assert.AreEqual(3, batch.TotalRecords);
            Assert.AreEqual(0, batch.RecordsFormatted);

            mock.Verify(c => c.GetMaxMfn(It.IsAny <string>()), Times.Once);
        }
Example #3
0
 public void BatchRecordFormatter_Interval_1a()
 {
     string database                    = "IBIS";
     int    batchSize                   = 0;
     string format                      = "Format";
     Mock <IIrbisConnection> mock       = GetMock();
     IIrbisConnection        connection = mock.Object;
     BatchRecordFormatter    batch
         = (BatchRecordFormatter)BatchRecordFormatter.Interval
           (
               connection,
               database,
               format,
               1,
               3,
               batchSize
           );
 }