Exemplo n.º 1
0
        public void Builders_DatBuilder_BuildDocument_Reps()
        {
            // test with an empty path prefix
            RepresentativeBuilder rep = new RepresentativeBuilder(
                "NATIVE", Representative.FileType.Native);

            builder.RepresentativeBuilders = new List <RepresentativeBuilder>()
            {
                rep
            };
            builder.SetHeader(records[0]);
            Document doc = builder.BuildDocument(records[1]);

            Assert.AreEqual(Representative.FileType.Native, doc.Representatives.First().Type);
            Assert.AreEqual(records[1][0], doc.Representatives.First().Files.First().Key);
            string expected = "X:\\VOL001\\NATIVE\\0001\\DOC000001.XLSX";

            Assert.AreEqual(expected, doc.Representatives.First().Files.First().Value);

            // test with a populated path prefix
            string[] newRecord = new string[records[1].Length];
            records[1].CopyTo(newRecord, 0);
            newRecord[5] = "\\VOL001\\NATIVE\\0001\\DOC000001.XLSX";
            builder.RepresentativeBuilders = new RepresentativeBuilder[] { rep };
            builder.KeyColumnName          = "DOCID";
            builder.PathPrefix             = "Z:\\";
            doc = builder.BuildDocument(newRecord);
            Assert.AreEqual(Representative.FileType.Native, doc.Representatives.First().Type);
            Assert.AreEqual(records[1][0], doc.Representatives.First().Files.First().Key);
            expected = "Z:\\VOL001\\NATIVE\\0001\\DOC000001.XLSX";
            Assert.AreEqual(expected, doc.Representatives.First().Files.First().Value);
        }