/// <summary>
 /// Initializes a new instance of <see cref="TextFileInfo"/>.
 /// </summary>
 /// <param name="textSettings">The <see cref="TextBuilder"/> used to build this object.</param>
 public TextFileInfo(TextBuilder textSettings)
 {
     this.FileLevel    = textSettings.FileLevel;
     this.FileLocation = textSettings.FileLocation;
     this.PathFind     = textSettings.PathFind;
     this.PathReplace  = textSettings.PathReplace;
 }
Exemple #2
0
        public void Importers_LfpImporter_Test()
        {
            // arrange
            FileInfo infile   = new FileInfo(@"X:\VOL001\infile.lfp");
            Encoding encoding = Encoding.GetEncoding(1252);

            TextBuilder.TextLevel    textLevel    = TextBuilder.TextLevel.None;
            TextBuilder.TextLocation textLocation = TextBuilder.TextLocation.None;
            string      pattern    = String.Empty;
            Regex       find       = new Regex(pattern);
            string      replace    = String.Empty;
            TextBuilder repSetting = new TextBuilder(textLevel, textLocation, find, replace);
            var         builder    = new LfpBuilder();

            builder.PathPrefix  = infile.Directory.FullName;
            builder.TextBuilder = repSetting;
            var mockParser = new Mock <LfpParser>(MockBehavior.Strict);

            mockParser.Setup(p => p.Parse(It.IsAny <TextReader>())).Returns(records);
            mockParser.Setup(p => p.Parse(It.IsAny <FileInfo>(), It.IsAny <Encoding>())).Returns(records);
            importer         = new LfpImporter();
            importer.Parser  = mockParser.Object;
            importer.Builder = builder;

            // act
            DocumentCollection docs = importer.Import(infile, encoding);

            // assert
            Assert.AreEqual(10, docs.Count);
            Assert.AreEqual(25, docs.ImageCount);
            Assert.AreEqual(0, docs.TextCount);
            Assert.AreEqual(1, docs.NativeCount);
            Assert.AreEqual(3, docs.ParentCount);
            Assert.AreEqual(5, docs.ChildCount);
            Assert.AreEqual(2, docs.StandAloneCount);
        }