Exemplo n.º 1
0
        public void CombineStringsMakeDirectoryPathTest()

        {
            // Assign
            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            // Act
            dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            // Assert
            Assert.IsTrue(Directory.Exists(dirPath));
        }
Exemplo n.º 2
0
        public void CombineStringsMakeDirectoryPathTest_CombineThreeDirectories()
        {
            // Assign

            var dirPath1 = @"C:\Users\art2m_000";

            var dirPath2 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(
                dirPath1, dirPath2, dirName);
        }
Exemplo n.º 3
0
        private void OnDeleteUserButton_Click(object sender, EventArgs e)
        {
            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var userName = SpellingPropertiesClass.UserName;

            dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperations.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            var retVal = SpellingReadWriteClass.ReadUserNameFile(filePath);

            if (!retVal)

            {
                return;
            }

            retVal = this.usnc.ContainsItem(SpellingPropertiesClass.UserName);

            if (!retVal)
            {
                return;
            }

            var index = this.usnc.GetItemIndex(SpellingPropertiesClass.UserName);

            retVal = this.usnc.RemoveItemAt(index);

            if (!retVal)
            {
                return;
            }


            //SpellingReadWriteClass.ReadUserNameFile(filePath);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Read users names list from file.
        /// </summary>
        /// <created>art2m,5/20/2019</created>
        /// <changed>art2m,5/20/2019</changed>
        private void ReadUserFileFillListBox()
        {
            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            var fileName = SpellingPropertiesClass.GetArt2MSpellUserListFileName;

            var filePath = DirectoryFileOperations.CombineDirectoryPathFileNameCheckCreateFile(dirPath, fileName);

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            if (!SpellingReadWriteClass.ReadUsersSpellingListPathsFile(filePath))
            {
                return;
            }

            this.FillListBoxWithUserNames();

            /*var dirPath = DirectoryFileOperations.CheckExistsCreateArt2MSpellPathDirectory();
             *
             * if (string.IsNullOrEmpty(dirPath))
             * {
             *  return;
             * }
             *
             * var filePath = DirectoryFileOperations.CreatePathToUserFile(dirPath);
             *
             * if (string.IsNullOrEmpty(filePath))
             * {
             *  return;
             * }
             *
             * if (!SpellingReadWriteClass.ReadUserNameFile(filePath))
             * {
             *  return;
             * }
             *
             * this.FillListBoxWithUserNames();*/
        }
Exemplo n.º 5
0
        public void CombineStringsMakeDirectoryPathTest_CombineFourDirectories()
        {
            var dirPath1 = @"C:\Users\art2m_000";

            var dirPath3 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            // Act
            var dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(
                dirPath1, dirPath2, dirName);

            // Assert
            Assert.IsTrue(Directory.Exists(dirPath));
        }
Exemplo n.º 6
0
        public void CreateUserSpellingListDirectoryTest_InValidDirectoryName()
        {
            // Assign
            var          dirPath  = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            const string DirName  = "Art2MSpell";
            const string UserName = "******";

            // Act
            var dirArt2MSpell = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, DirName);

            var userDir = Path.Combine(dirArt2MSpell, UserName);

            var filePath = Path.GetFullPath(userDir);

            // Assert
            Assert.IsFalse(Directory.Exists(userDir));
        }
Exemplo n.º 7
0
        public void CreateUserSpellingListDirectory_TestArgumentNullException()
        {
            // Assign
            string dirPath = null;
            var    dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            SpellingPropertiesClass.UserName = "******";

            // Act
            var dirArt2MSpell = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            DirectoryFileOperations.CreateUserSpellingListDirectory(dirPath)


            // Assert
            Assert.IsTrue(Directory.Exists(userDir));
        }
Exemplo n.º 8
0
        private void OnDeleteUserButton_Click(object sender, EventArgs e)
        {
            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var userName = SpellingPropertiesClass.UserName;

            dirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(dirPath))
            {
                return;
            }

            filePath =
                SpellingReadWriteClass.ReadUserNameFile(filePath);
        }
Exemplo n.º 9
0
        public void CombineDirectoryPathFileNameCheckCreateFile_TestCheckFileExistsOrCreateFile()
        {
            // Assign
            var dirPath1 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var fileName = @"Ar2mSpellUserList";

            // Act
            var dirPath  = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath1, dirName);
            var filePath = Path.Combine(dirPath, fileName);


            // Assert
            Assert.IsTrue(File.Exists(filePath));
        }
Exemplo n.º 10
0
        /// ********************************************************************************
        /// <summary>
        /// Get the path to the users spelling list directory.
        /// </summary>
        /// <returns></returns>
        /// <created>art2m,5/23/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static string GetUsersSpellingListDirectoryPath()
        {
            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var pathArt2MSpell = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(pathArt2MSpell))
            {
                return(string.Empty);
            }

            var userName = SpellingPropertiesClass.UserName;

            var userDirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(pathArt2MSpell, userName);

            return(string.IsNullOrEmpty(userDirPath) ? string.Empty : userDirPath);
        }
Exemplo n.º 11
0
        /// ********************************************************************************
        /// <summary>
        ///     Get the path to the users spelling list directory.
        /// </summary>
        /// <returns></returns>
        /// <created>art2m,5/23/2019</created>
        /// <changed>art2m,5/23/2019</changed>
        /// ********************************************************************************
        private static string GetUsersSpellingListDirectoryPath()
        {
            var dirPath = SpellingPropertiesClass.AppDataDirectoryPath;
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var pathArt2MSpell = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            if (string.IsNullOrEmpty(pathArt2MSpell))
            {
                return(string.Empty);
            }

            var userName = SpellingPropertiesClass.UserName;

            var userDirPath = DirectoryFileOperations.CombineStringsMakeDirectoryPath(pathArt2MSpell, userName);

            return(string.IsNullOrEmpty(userDirPath) ? string.Empty : userDirPath);
        }
Exemplo n.º 12
0
        public void CreateUserSpellingListDirectoryTest_ValidTest()
        {
            // Assign
            var          dirPath  = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            const string DirName  = "Art2MSpell";
            const string UserName = "******";

            // Act
            var dirArt2MSpell = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, DirName);

            var userDir = Path.Combine(dirArt2MSpell, UserName);

            if (!Directory.Exists(userDir))
            {
                Directory.CreateDirectory(userDir);
            }

            // Assert
            Assert.IsTrue(Directory.Exists(userDir));
        }
Exemplo n.º 13
0
        public void CreateUserSpellingListDirectory_TestDirectoryExistsOrIsCreated()
        {
            // Assign
            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            SpellingPropertiesClass.UserName = "******";

            // Act
            var dirArt2MSpell = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            var userDir = Path.Combine(dirArt2MSpell, SpellingPropertiesClass.UserName);

            if (!Directory.Exists(userDir))
            {
                Directory.CreateDirectory(userDir);
            }

            // Assert
            Assert.IsTrue(Directory.Exists(userDir));
        }
Exemplo n.º 14
0
        public void CombineDirectoryPathFileNameCheckCreateFile_TestCheckFileExistsOrCreateFile()
        {
            // Assign
            var dirPath1 = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var file

            // Act

            var dirPath  = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath1, dirName);
            var filePath = Path.Combine(dirPath, fileName);

            if (!File.Exists(filePath))
            {
                File.Create(filePath).Dispose();
            }

            return(!File.Exists(filePath) ? string.Empty : filePath);
        }
Exemplo n.º 15
0
        public void CreateUserSpellingListDirectoryTest()
        {
            // Assign
            var dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            var dirName = SpellingPropertiesClass.GetArt2MSpellDirectoryName;

            var dirArt2MSpell = DirectoryFileOperations.CombineStringsMakeDirectoryPath(dirPath, dirName);

            dirName = SpellingPropertiesClass.UserName;

            dirPath = Path.Combine(dirPath, dirName);

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }

            return(Directory.Exists(dirPath));

            // Act

            // Assert
            Assert.Fail();
        }