public void GetMultimediaFilePath()
 {
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\ms18.mp4"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\DUSTCELL - DERO.mp3"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\bell.png"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\pexels-photo-4173624.jpeg"));
 }
 public void GetPathForTextFile()
 {
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\0.5.2.docx"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\Neechy.pptx"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\test.txt"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\sds.pdf"));
 }
 public void GetPathWithSpecificAlphabetName()
 {
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\신의 탑.txt"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\鋼の錬金術師.txt"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\นรางามิ เทวดาขาจร.txt"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\Тест єії'.txt"));
 }
 public void GetSpecialFilePath()
 {
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\0524.torrent"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\IIG.Core.FileWorkingUtils.pdb"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\vlc-3.0.10-win64.exe"));
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\-73_1_1.zip"));
 }
예제 #5
0
        public void TestGetPath(string filename)
        {
            string pathExpected     = testsDirFullPath + "\\" + filename;
            string filePathExpected = testsDirFullPath;

            Assert.Equal(filePathExpected, BaseFileWorker.GetPath(pathExpected));
        }
예제 #6
0
 public void TestGetPathException(string filename)
 {
     try {
         BaseFileWorker.GetPath(filename);
     } catch (Exception e) {
         Assert.NotNull(e);
     }
 }
예제 #7
0
 public void Test_GetPath_Different_Types()
 {
     Assert.AreEqual("C:\\TestFiles", BaseFileWorker.GetPath("C:\\TestFiles\\1.txt"));
     Assert.AreEqual("C:\\TestFiles", BaseFileWorker.GetPath("C:\\TestFiles\\1.bmp"));
     Assert.AreEqual("C:\\TestFiles", BaseFileWorker.GetPath("C:\\TestFiles\\1.mpp"));
     Assert.AreEqual("C:\\TestFiles", BaseFileWorker.GetPath("C:\\TestFiles\\1.odg"));
     Assert.AreEqual("C:\\TestFiles", BaseFileWorker.GetPath("C:\\TestFiles\\1.rar"));
     Assert.AreEqual("C:\\TestFiles", BaseFileWorker.GetPath("C:\\TestFiles\\1.rtf"));
     Assert.AreEqual("C:\\TestFiles", BaseFileWorker.GetPath("C:\\TestFiles\\1.mp4"));
 }
예제 #8
0
        public void GetPath_ReturnsNull_NonExist_Files(string file)
        {
            try { File.Delete(file); }             // ensure file doesn't exist
            catch (Exception e) { }
            Action codeToTest = () =>
            {
                var results = BaseFileWorker.GetPath(file);
                Assert.Null(results);
            };
            var ex = Record.Exception(codeToTest);

            Assert.Null(ex);
        }
예제 #9
0
 public void GetPathReturnValidTest()
 {
     //regular
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + "\\a.txt"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\a.txt"));
     //file with no extension
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\IIG"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\IIG"));
     //get file path with space in file name
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\I IG.txt"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\I IG.txt"));
     //get file path with space in folder name
     Assert.Equal(pathToFiles + "\\II G", BaseFileWorker.GetPath(pathToFiles + @"\II G\test.txt"));
     Assert.Equal(pathToFiles + "\\II G", BaseFileWorker.GetPath(@"..\..\..\Files\II G\test.txt"));
     //with cyrilic in file name
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\абв.txt"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\абв.txt"));
     //with cyrilic in folder name
     Assert.Equal(pathToFiles + "\\йцуке", BaseFileWorker.GetPath(pathToFiles + @"\йцуке\tset.txt"));
     Assert.Equal(pathToFiles + "\\йцуке", BaseFileWorker.GetPath(@"..\..\..\Files\йцуке\tset.txt"));
     //with ieroglif in file name
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\お母様.txt"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\お母様.txt"));
     //with ieroglif in folder name
     Assert.Equal(pathToFiles + "\\到着した", BaseFileWorker.GetPath(pathToFiles + @"\到着した\test.txt"));
     Assert.Equal(pathToFiles + "\\到着した", BaseFileWorker.GetPath(@"..\..\..\Files\到着した\test.txt"));
     //with few dots in file name
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\a.b.c.txt"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\a.b.c.txt"));
     //with few dots in folder name
     Assert.Equal(pathToFiles + "\\dot.dot", BaseFileWorker.GetPath(pathToFiles + @"\dot.dot\test.txt"));
     Assert.Equal(pathToFiles + "\\dot.dot", BaseFileWorker.GetPath(@"..\..\..\Files\dot.dot\test.txt"));
     //with smiles in file name
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\😅.txt"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\😅.txt"));
     //with smiles in folder name
     Assert.Equal(pathToFiles + "\\😂😂", BaseFileWorker.GetPath(pathToFiles + @"\😂😂\test.txt"));
     Assert.Equal(pathToFiles + "\\😂😂", BaseFileWorker.GetPath(@"..\..\..\Files\😂😂\test.txt"));
     //with different extensions
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\a.csc"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\a.csc"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\a.docx"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\a.docx"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\a.mp4"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\a.mp4"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\a.pptx"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\a.pptx"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(pathToFiles + @"\a.torrent"));
     Assert.Equal(pathToFiles, BaseFileWorker.GetPath(@"..\..\..\Files\a.torrent"));
 }
예제 #10
0
        public void Test_GetPath_EmptyPath()
        {
            try
            {
                const string pathEmpty = "";
                string       received  = BaseFileWorker.GetPath(pathEmpty);

                Assert.IsNull(received, "The filename retrieved from GetFileName by empty path " +
                              "must be NULL!");
            }
            catch (Exception err)
            {
                Assert.Fail(err.Message);
            }
        }
예제 #11
0
        public void Test_GetPath_NoExisting_RelativePath()
        {
            try
            {
                const string pathRel  = ".\\..\\..\\NoExist.txt";
                string       received = BaseFileWorker.GetPath(pathRel);

                Assert.IsNull(received, "The filename retrieved from GetFileName by relative path " +
                              "must be NULL on a path that does not exist!");
            }
            catch (Exception err)
            {
                Assert.Fail(err.Message);
            }
        }
예제 #12
0
        public void Test_GetPath_NoExisting_FullPath()
        {
            try
            {
                const string pathAbs  = "D:\\GitHub\\software-testing\\MaksGovor.FileWorker.Test\\NoExist.txt";
                string       received = BaseFileWorker.GetPath(pathAbs);

                Assert.IsNull(received, "The filename retrieved from GetFileName by full path " +
                              "must be NULL on a path that does not exist!");
            }
            catch (Exception err)
            {
                Assert.Fail(err.Message);
            }
        }
예제 #13
0
 public void GetPathReturnNullTest()
 {
     //without file
     Assert.Null(BaseFileWorker.GetPath(pathToFiles));
     Assert.Null(BaseFileWorker.GetPath(@"..\..\..\Files"));
     //folder
     Assert.Null(BaseFileWorker.GetPath(pathToFiles + "\\empty"));
     Assert.Null(BaseFileWorker.GetPath(@"..\..\..\Files\empty"));
     //non-existed file
     Assert.Null(BaseFileWorker.GetPath(pathToFiles + "\\empty\\test.txt"));
     Assert.Null(BaseFileWorker.GetPath(@"..\..\..\Files\empty\test.txt"));
     //file but forgot to type extension
     Assert.Null(BaseFileWorker.GetPath(pathToFiles + "\\test"));
     Assert.Null(BaseFileWorker.GetPath(@"..\..\..\Files\test"));
 }
예제 #14
0
        public void GetPath_ReturnsDirPath_CurrentDir()
        {
            string path = TEMP_FILE_PATH;

            File.WriteAllText(path, "");
            string results    = null;
            string expected   = CurrentDirectory;
            Action codeToTest = () =>
            {
                results = BaseFileWorker.GetPath(path);
            };
            var ex = Record.Exception(codeToTest);

            Assert.Null(ex);
            Assert.Equal(expected, results);
            File.Delete(path);
        }
예제 #15
0
        public void Test_GetPath_Existing_RelativePath()
        {
            try
            {
                const string pathRel  = ".\\..\\..\\testfile.txt";
                string       received = BaseFileWorker.GetPath(pathRel);

                const string available = "D:\\GitHub\\software-testing\\MaksGovor.FileWorker.Test";

                Assert.AreEqual(available, received, "The path retrieved from GetPath by relative path " +
                                "do not match the available result!");
            }
            catch (Exception err)
            {
                Assert.Fail(err.Message);
            }
        }
예제 #16
0
        public void GetPath_ReturnsDirPath_NestedDir()
        {
            string filename = "filename.txt";

            Directory.CreateDirectory("dir1"); Directory.CreateDirectory("dir1\\dir2");
            string expected_dirPath = $"{CurrentDirectory}\\dir1\\dir2";
            string path             = $"dir1\\dir2\\{filename}";

            File.WriteAllText(path, "");
            string results    = null;
            Action codeToTest = () =>
            {
                results = BaseFileWorker.GetPath(path);
            };
            var ex = Record.Exception(codeToTest);

            Assert.Null(ex);
            Assert.Equal(expected_dirPath, results);
        }
 public void GetPathWithoutExtencion()
 {
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\IIG"));
 }
 public void GetPathWithAltCodesName()
 {
     Assert.Equal("C:\\FileWokerTest\\GetFilesSomethingTest", BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\☺☻♥♫►.txt"));
 }
        public void GetPath_FileDoesNotExist_ReturnNull()
        {
            string result = BaseFileWorker.GetPath(pathToLabFolder + "/somefile2.txt");

            Assert.AreEqual(null, result);
        }
예제 #20
0
 public void Test_GetPath_No_Extension()
 {
     Assert.IsNull(BaseFileWorker.GetPath("C:\\TestFiles\\1"));
 }
예제 #21
0
 public void Test_GetPath_Non_Existent_File()
 {
     Assert.IsNull(BaseFileWorker.GetPath("C:\\TestFiles\\2.txt"));
 }
예제 #22
0
 public void Test_GetPath_Empty_Path()
 {
     Assert.IsNull(BaseFileWorker.GetPath(""));
 }
 public void GetFilePathWithoutPath()
 {
     Assert.Null(BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest"));
 }
        public void GetPath_FileExists_ReturnPathToFile()
        {
            string result = BaseFileWorker.GetPath(pathToLabFolder + "/somefile.txt");

            Assert.AreEqual(pathToLabFolder, result);
        }
 public void GetPathFOrNotExistingFile()
 {
     Assert.Null(BaseFileWorker.GetPath("C:\\FileWokerTest\\GetFilesSomethingTest\\void"));
 }