Ejemplo n.º 1
0
        public void Test003a_GetContent_ThrowsAnExceptionIfFileDoesntExist()
        {
            var path = "dfgdfg.txt";

            var p = new PXDocument(path);

            Assert.Throws(typeof(Exception), () => p.ReadAllLines());
        }
Ejemplo n.º 2
0
        public void Test002_InvalidMessageOnGetTypeSinceFileDoesntExist()
        {
            //Arrange
            var data = new PXDocument("dfhgfgsfhs.txt");

            //act & assert
            Assert.Throws(typeof(Exception), () => { var t = data.Type; });
        }
Ejemplo n.º 3
0
        public void Test002_CheckContentInTestFile()
        {
            var path = DataFile("test.txt");

            var p = new PXDocument(path);

            Assert.AreEqual(new List <string>()
            {
                "blabla1", "blabla2"
            }, p.ReadAllLines());
        }
Ejemplo n.º 4
0
        public void Test001_GetType_VerifyCurrentFolderIsaDirectory()
        {
            //Arrange
            var p = Directory.GetCurrentDirectory();

            //Act
            var type = new PXDocument(p).Type;

            //Assert
            Assert.AreEqual(PathType.Directory, type);
        }
Ejemplo n.º 5
0
        public void Test004_CheckDuplicatesOnFriends()
        {
            contentFilter = new ContentFilter();

            var friendss05e14 = new PXDocument(DataFile("FRIENDS_05x14.srt"));
            var testDoc       = new PXDocument(TmpFile("FRIENDS_05x14_result.txt"));

            project = new Splitter(contentFilter);

            var r = project.Process(friendss05e14.ReadAllText(), new Processor());

            Assert.AreEqual(1, r.Where(i => i == "you").Count());
        }
Ejemplo n.º 6
0
        public void Test001_Write_CheckAFileIsWrittenAndClearIt()
        {
            var l = new List <string>()
            {
                "blabla", "chiasse"
            };
            var fileWriter = new FileWriter(new PXStreamWriterFactory());
            var testDoc    = new PXDocument(TmpFile("test.txt"));

            //Write
            fileWriter.Write(testDoc.Path, l);
            Assert.AreEqual(PathType.File, testDoc.Type);
            Assert.AreEqual(l, File.ReadAllLines(testDoc.Path));
            Assert.AreEqual("blabla\r\nchiasse\r\n", testDoc.ReadAllText());

            //Clear
            testDoc.Clear();
            Assert.AreEqual("", File.ReadAllLines(testDoc.Path));
        }
Ejemplo n.º 7
0
        public BaseIntegrationTesting()
        {
            if (!UseTmpFolder && !UseDataFolder)
            {
                return;
            }

            //Directory.GetCurrentDirectory() m'envoie dans l'AppData/Local/Temp
            var executingAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
            var p = new PXDocument(Path.GetDirectoryName(executingAssemblyPath));

            if (UseTmpFolder)
            {
                tmpFolder = new PXDocument(Path.Combine(p.GetParent(3), DATA_FOLDER_NAME, TMP_FOLDER_NAME));
            }
            if (UseDataFolder)
            {
                dataFolder = new PXDocument(Path.Combine(p.GetParent(3), DATA_FOLDER_NAME));
            }
        }
Ejemplo n.º 8
0
        public void Test02b_GetParent_TooMuchCountThrowsAnException()
        {
            var p = new PXDocument(@"C:\SIMULATIONS\CMG\328FT\Asdsfg");

            Assert.Throws(typeof(Exception), () => p.GetParent(10));
        }
Ejemplo n.º 9
0
        public void Test002a_GetParent_VerifiyCountTwo()
        {
            var p = new PXDocument(@"C:\SIMULATIONS\CMG\328FT\Asdsfg");

            Assert.AreEqual(@"C:\SIMULATIONS\CMG", p.GetParent(2));
        }