Beispiel #1
0
        public void Folder_Update_for_WebApi_Project()
        {
            // Run FolderUpdate on the test project
            ProjectType  projectType  = ProjectType.WebApi;
            FolderUpdate folderUpdate = new FolderUpdate(
                _testProjectPath, projectType);

            folderUpdate.Run();

            // Validate Program.cs and Startup.cs files are created
            Assert.True(File.Exists(Path.Combine(
                                        _testProjectDir, FileTypeCreation.Program.ToString() + ".cs")));
            Assert.True(File.Exists(Path.Combine(
                                        _testProjectDir, FileTypeCreation.Startup.ToString() + ".cs")));

            Cleanup(_testProjectDir);
        }
Beispiel #2
0
        public void Folder_Update_for_Mvc_Project_When_Content_Scripts_Folders_Already_Exist_In_Wwwroot()
        {
            // Create MVC Content and Script folders under MVC test project folder
            Directory.CreateDirectory(
                Path.Combine(_testProjectDir, Constants.Content));
            Directory.CreateDirectory(
                Path.Combine(_testProjectDir, Constants.Scripts));

            // Create target wwwroot folder
            // And create Content and Scripts folders under wwwroot
            Directory.CreateDirectory(
                Path.Combine(_testProjectDir, Constants.Wwwroot));
            Directory.CreateDirectory(Path.Combine(
                                          _testProjectDir, Constants.Wwwroot, Constants.Content));
            Directory.CreateDirectory(Path.Combine(
                                          _testProjectDir, Constants.Wwwroot, Constants.Scripts));


            // Run FolderUpdate on the test project
            ProjectType  projectType  = ProjectType.Mvc;
            FolderUpdate folderUpdate = new FolderUpdate(
                _testProjectPath, projectType);

            folderUpdate.Run();

            // Validate Content and Script folders are not moved under wwwroot since they already exist in wwwroot
            Assert.True(Directory.Exists(
                            Path.Combine(_testProjectDir, Constants.Content)));
            Assert.True(Directory.Exists(
                            Path.Combine(_testProjectDir, Constants.Scripts)));
            Assert.True(Directory.Exists(
                            Path.Combine(_testProjectDir, Constants.Wwwroot)));
            Assert.True(Directory.Exists(Path.Combine(
                                             _testProjectDir, Constants.Wwwroot, Constants.Content)));
            Assert.True(Directory.Exists(Path.Combine(
                                             _testProjectDir, Constants.Wwwroot, Constants.Scripts)));

            // Validate Program.cs and Startup.cs files are created
            Assert.True(File.Exists(Path.Combine(
                                        _testProjectDir, FileTypeCreation.Program.ToString() + ".cs")));
            Assert.True(File.Exists(Path.Combine(
                                        _testProjectDir, FileTypeCreation.Startup.ToString() + ".cs")));

            Cleanup(_testProjectDir);
        }
Beispiel #3
0
        public void Folder_Update_for_Mvc_Project()
        {
            // Create MVC Content and Script foldel under MVC test project folder
            Directory.CreateDirectory(
                Path.Combine(_testProjectDir, Constants.Content));
            Directory.CreateDirectory(
                Path.Combine(_testProjectDir, Constants.Scripts));

            // Run FolderUpdate on the test project
            ProjectType  projectType  = ProjectType.Mvc;
            FolderUpdate folderUpdate = new FolderUpdate(
                _testProjectPath, projectType);

            folderUpdate.Run();

            // Validate wwwroot folder gets created, and Content and Script folders
            // get moved under wwwroot folder
            Assert.False(Directory.Exists(
                             Path.Combine(_testProjectDir, Constants.Content)));
            Assert.False(Directory.Exists(
                             Path.Combine(_testProjectDir, Constants.Scripts)));
            Assert.True(Directory.Exists(
                            Path.Combine(_testProjectDir, Constants.Wwwroot)));
            Assert.True(Directory.Exists(Path.Combine(
                                             _testProjectDir, Constants.Wwwroot, Constants.Content)));
            Assert.True(Directory.Exists(Path.Combine(
                                             _testProjectDir, Constants.Wwwroot, Constants.Scripts)));

            // Validate Program.cs and Startup.cs files are created
            Assert.True(File.Exists(Path.Combine(
                                        _testProjectDir, FileTypeCreation.Program.ToString() + ".cs")));
            Assert.True(File.Exists(Path.Combine(
                                        _testProjectDir, FileTypeCreation.Startup.ToString() + ".cs")));

            Cleanup(_testProjectDir);
        }