Exemplo n.º 1
0
        public void CombineFile()
        {
            var settings = Randomize.TextSettings.AllowNumbers |
                           Randomize.TextSettings.AllowPunctuation |
                           Randomize.TextSettings.AllowSpace |
                           Randomize.TextSettings.AllowBigLetters |
                           Randomize.TextSettings.AllowSmallLetters;

            var fileNames = Randomize.Array(() => Randomize.String(5, 10, settings), 10);

            foreach (var fileName in fileNames)
            {
                var newFile = DirectoryPath.Current.CombineFile(fileName);

                Assert.False(newFile.Exists);
                Assert.Equal(fileName, newFile.Name);
                Assert.Equal(DirectoryPath.Current, newFile.Parent);

                newFile.Touch();

                Assert.True(newFile.Exists);
                Assert.Equal(fileName, newFile.Name);
                Assert.Equal(DirectoryPath.Current, newFile.Parent);
            }
        }
Exemplo n.º 2
0
        public void Delete()
        {
            var directoryNames = Randomize.Array(() => Randomize.String(5, 10, directoryNameSettings), 10);

            foreach (var directoryName in directoryNames)
            {
                var newDirectory = DirectoryPath.Current.CombineDirectory(directoryName);

                Assert.False(newDirectory.Exists);

                newDirectory.Touch();

                Assert.True(newDirectory.Exists);

                newDirectory.Delete();

                Assert.False(newDirectory.Exists);
            }
        }
Exemplo n.º 3
0
        public void CombineDirectory()
        {
            var directoryNames = Randomize.Array(() => Randomize.String(5, 10, directoryNameSettings), 10);

            foreach (var directoryName in directoryNames)
            {
                var newDirectory = DirectoryPath.Current.CombineDirectory(directoryName);

                Assert.False(newDirectory.Exists);
                Assert.Equal(directoryName, newDirectory.Name);
                Assert.Equal(DirectoryPath.Current, newDirectory.Parent);

                newDirectory.Touch();

                Assert.True(newDirectory.Exists);
                Assert.True(newDirectory.IsEmpty);
                Assert.Equal(directoryName, newDirectory.Name);
                Assert.Equal(DirectoryPath.Current, newDirectory.Parent);
            }
        }