Esempio n. 1
0
        public void EqualsTest()
        {
            var       relativePath = @"..\..\MockUserFiles\Draft_Environmental_Assessment.docx";
            InputFile target       = new DocXFile(relativePath);
            object    obj          = null;
            var       expected     = false;
            bool      actual;

            actual = target.Equals(obj);
            Check.That(actual).IsEqualTo(expected);
            obj      = new DocXFile(relativePath);
            expected = true;
            actual   = target.Equals(obj);
            Check.That(actual).IsEqualTo(expected);
            var other = new TxtFile(@"..\..\MockUserFiles\Draft_Environmental_Assessment.txt");

            expected = false;
            actual   = target.Equals(other);
            InputFile other1 = new DocXFile(@"..\..\MockUserFiles\Draft_Environmental_Assessment.docx");

            expected = true;
            actual   = target.Equals(other1);
            var other2 = new DocXFile(@"..\..\MockUserFiles\Draft_Environmental_Assessment.docx");

            expected = true;
            actual   = target.Equals(other2);
            Check.That(actual).IsEqualTo(expected);
        }
Esempio n. 2
0
        public void DocXFileConstructorTest()
        {
            var path   = @"..\..\..\TestDocs\Draft_Environmental_Assessment.docx";
            var target = new DocXFile(path);

            Check.That(new FileInfo(path)).Exists();
            Check.That(Path.GetFullPath(path)).IsEqualTo(target.FullPath);
        }
Esempio n. 3
0
        public void FullPathTest1()
        {
            var       relativePath = @"..\..\MockUserFiles\Draft_Environmental_Assessment.docx";
            InputFile target       = new DocXFile(relativePath);
            var       expected     = System.IO.Path.GetFullPath(relativePath);
            var       actual       = target.FullPath;

            Check.That(actual).IsEqualTo(expected);
        }
Esempio n. 4
0
        public void GetHashCodeTest()
        {
            var       relativePath = @"..\..\MockUserFiles\Draft_Environmental_Assessment.docx";
            InputFile target       = new DocXFile(relativePath);
            var       expected     = new DocXFile(relativePath).GetHashCode();
            int       actual;

            actual = target.GetHashCode();
            Check.That(actual).IsEqualTo(expected);
        }
Esempio n. 5
0
        public void ExtTest()
        {
            var       fullPath = @"..\..\MockUserFiles\Draft_Environmental_Assessment.docx";
            InputFile target   = new DocXFile(fullPath);
            var       expected = ".docx";
            string    actual;

            actual = target.Extension;
            Check.That(actual).IsEqualTo(expected);
        }
Esempio n. 6
0
        public void DirectoryTest()
        {
            var       relativePath = @"..\..\MockUserFiles\Draft_Environmental_Assessment.docx";
            InputFile target       = new DocXFile(relativePath);
            var       expected     = new System.IO.FileInfo(relativePath).Directory.FullName + "\\";
            string    actual;

            actual = target.Directory;
            Check.That(actual).IsEqualTo(expected);
        }
Esempio n. 7
0
        public void op_InequalityTest()
        {
            InputFile left     = new TxtFile(TestTextFilePath);
            InputFile right    = null;
            var       expected = true;
            bool      actual;

            actual = (left != right);
            Check.That(actual).IsEqualTo(expected);

            right    = new DocXFile(@"..\..\MockUserFiles\Draft_Environmental_Assessment.docx");
            expected = true;
            actual   = (left != right);
            Check.That(actual).IsEqualTo(expected);
            right    = new TxtFile(TestTextFilePath);
            expected = false;
            actual   = (left != right);
            Check.That(actual).IsEqualTo(expected);
        }
Esempio n. 8
0
 private static void RemoveFile(DocXFile file) => docXFiles = docXFiles.Remove(file);
Esempio n. 9
0
 private static void AddToTypedList(DocXFile file) => docXFiles     = docXFiles.Add(file);
Esempio n. 10
0
        /// <summary>
        /// Parses the contents of a raw, untagged DocXFile into a new Document instance.
        /// </summary>
        /// <param name="docx">The raw, untagged DocXFile to parse.</param>
        /// <returns>
        /// The contents of the DocXFile composed into a fully reified
        /// <see cref="Document"/> instance.
        /// </returns>
        public Document DocumentFromDocX(DocXFile docx)
        {
            var txt = new DocxToTextConverter(docx).ConvertFile();

            return(new TaggedSourceParser(new TaggedFile(new SharpNLPTagger(this.TaggerMode, txt.FullPath).ProcessFile())).LoadDocument(txt.NameSansExt));
        }