Пример #1
0
        public void Can_Create_Correctly()
        {
            var temp     = Path.GetTempPath();
            var guid     = Guid.NewGuid().ToString();
            var tempPath = Path.Combine(temp, guid).TrimEnd('/');

            try
            {
                var builder = new DirectoryBuilder(tempPath, true)
                              .AddFile("file1.txt")
                              .AddSubdirectoryAndEnter("dir1")
                              .AddFile("file11.txt")
                              .GoBack();

                builder.Create();

                Assert.True(File.Exists(Path.Combine(tempPath, "file1.txt")));
                Assert.True(Directory.Exists(Path.Combine(tempPath, "dir1")));
                Assert.True(File.Exists(Path.Combine(tempPath, "dir1//file11.txt")));
            }
            finally
            {
                Directory.Delete(tempPath, true);
            }
        }
Пример #2
0
        public void Can_Create_Base_Dir_If_Dont_Exists()
        {
            var temp     = Path.GetTempPath();
            var guid     = Guid.NewGuid().ToString();
            var tempPath = Path.Combine(temp, guid).TrimEnd('/');

            try
            {
                var dirBuilder = new DirectoryBuilder(tempPath, true);
                dirBuilder.Create();
                Directory.Exists(tempPath);
            }
            finally
            {
                Directory.Delete(tempPath, true);
            }
        }