public void Exporters_XrefExporter_getNextImageKey()
        {
            var          docs     = GetDocs();
            TestExporter exporter = new TestExporter();

            exporter.SetDocs(docs);
            Assert.AreEqual("DOC000002", exporter.getNextImageKey(0, 0));
            Assert.AreEqual("DOC000003", exporter.getNextImageKey(0, 1));
            Assert.AreEqual(null, exporter.getNextImageKey(1, 1));
            Assert.AreEqual(null, exporter.getNextImageKey(2, 1));
        }
        public void Exporters_XrefExporter_getRecordComponents()
        {
            var          docs     = GetDocs();
            TestExporter exporter = new TestExporter();

            exporter.SetDocs(docs);
            var    settings = new XrefExport();
            string record   = String.Join(", ", exporter.getRecordComponents(0, 0));
            string expected = "X:\\VOL001\\IMAGES\\0001\\DOC000001.jpg, DOC, 000001, , 0, 0, 1, 0, 0, 0, 0, , , ";

            Assert.AreEqual(expected, record);
        }
        public void Exporters_XrefExporter_moveDocPos()
        {
            var          docs     = GetDocs();
            Document     first    = docs[0];
            Document     last     = docs[1];
            TestExporter exporter = new TestExporter();

            exporter.SetDocs(docs);
            Assert.AreEqual(last, exporter.getNextDoc(0));
            Assert.AreEqual(first, exporter.getPreviousDoc(1));
            Assert.AreEqual(null, exporter.getNextDoc(1));
            Assert.AreEqual(null, exporter.getPreviousDoc(0));
        }
        public void Exporters_XrefExporter_getEndFlag()
        {
            var     docs     = GetDocs();
            int     docIndex = 1;
            int     imgIndex = 0;
            Trigger trigger  = new Trigger();

            trigger.Type              = Switch.SwitchType.FieldValueChange;
            trigger.FieldName         = "DOCTYPE";
            trigger.FieldChangeOption = Switch.ValueChangeOption.None;
            TestExporter exporter = new TestExporter();

            exporter.SetDocs(docs);
            exporter.SetWaitingForFlag(true);
            Assert.IsTrue(exporter.getCodeEndFlag(docIndex, imgIndex, trigger.ToSwitch()));
            Assert.IsTrue(exporter.getGroupEndFlag(docIndex, imgIndex, trigger.ToSwitch()));
            exporter.SetWaitingForFlag(false);
            Assert.IsFalse(exporter.getCodeEndFlag(docIndex, imgIndex, trigger.ToSwitch()));
            Assert.IsFalse(exporter.getGroupEndFlag(docIndex, imgIndex, trigger.ToSwitch()));
        }
        public void Exporters_XrefExporter_getPageRecords()
        {
            var          docs     = GetDocs();
            TestExporter exporter = new TestExporter();

            exporter.SetDocs(docs);
            var field = new SlipsheetField();

            field.FieldName = "DOCID";
            field.Alias     = "begno";
            var     fields  = new SlipsheetField[] { field };
            Trigger trigger = new Trigger();

            trigger.Type              = Switch.SwitchType.FieldValueChange;
            trigger.FieldName         = "DOCID";
            trigger.FieldChangeOption = Switch.ValueChangeOption.None;
            var ss = SlipSheets.Builder
                     .Start(trigger.ToSwitch())
                     .SetAliasMap(fields.ToDictionary(f => f.FieldName, f => f.Alias))
                     .SetFolderName("SlipSheets")
                     .Build();

            ss.GenerateSlipSheets(docs);
            exporter.SetSlipsheets(ss);
            var           actual   = exporter.getPageRecords(1, ss);
            List <string> expected = new List <string>();

            expected.Add("\\SlipSheets\\DOC000001.001.TIF, DOC, 000001, .001, 0, 0, 1, 0, 0, 0, 1, , , ");
            expected.Add("X:\\VOL001\\IMAGES\\0001\\DOC000002.tif, DOC, 000002, , 0, 0, 1, 0, 0, 0, 0, , , ");
            expected.Add("X:\\VOL001\\IMAGES\\0001\\DOC000003.tif, DOC, 000003, , 0, 0, 0, 0, 0, 0, 0, , , ");

            for (int i = 0; i < expected.Count; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
        public void Exporters_XrefExporter_getGhostBoxLine()
        {
            var          docs     = GetDocs();
            TestExporter exporter = new TestExporter();

            exporter.SetDocs(docs);
            exporter.SetBoxNo(0);
            Trigger trigger = new Trigger()
            {
                Type = Switch.SwitchType.Family
            };

            exporter.SetBoxTrigger(trigger.ToSwitch());
            string result = exporter.getGhostBoxLine("DOC000001", String.Empty, 0, false);

            Assert.AreEqual(@"\Box001\..", result);
            result = exporter.getGhostBoxLine("DOC000002", String.Empty, 1, false);
            Assert.AreEqual(@"\Box001\..", result);
            result = exporter.getGhostBoxLine("DOC000003", String.Empty, 1, false);
            Assert.AreEqual(@"\Box001\..", result);
            trigger.Type      = Switch.SwitchType.FieldValueChange;
            trigger.FieldName = "DOCID";
            exporter.SetBoxTrigger(trigger.ToSwitch());
            exporter.SetBoxNo(0);
            result = exporter.getGhostBoxLine("DOC000001", String.Empty, 0, false);
            Assert.AreEqual(@"\Box001\..", result);
            result = exporter.getGhostBoxLine("DOC000002", String.Empty, 1, false);
            Assert.AreEqual(@"\Box002\..", result);
            result = exporter.getGhostBoxLine("DOC000003", String.Empty, 1, false);
            Assert.AreEqual(@"\Box002\..", result);
            exporter.SetBoxNo(1);
            result = exporter.getGhostBoxLine("DOC000002", String.Empty, 1, true);
            Assert.AreEqual(@"\Box001\..", result);
            result = exporter.getGhostBoxLine("DOC000002", String.Empty, 1, false);
            Assert.AreEqual(@"\Box002\..", result);
        }