Esempio n. 1
0
 public void Should_provide_the_directory_supplied_to_the_project_environment_for_the_project_directory()
 {
     string directory = @"c:\projects\nu";
     using (Record)
     {
         SetupResult.For(fileSystem.IsRooted(directory)).Return(true);
     }
     IProjectEnvironment environment = new ProjectEnvironment("", directory);
     Assert.That(environment.ProjectDirectory, Is.EqualTo(directory));
 }
Esempio n. 2
0
 public void Should_provide_the_last_folder_name_for_the_project_name_when_provided_a_specific_directory()
 {
     string directory = @"c:\projects\nu";
     using (Record)
     {
         SetupResult.For(fileSystem.DirectorySeparatorChar).Return(Path.DirectorySeparatorChar);
         SetupResult.For(fileSystem.IsRooted(directory)).Return(true);
     }
     IProjectEnvironment environment = new ProjectEnvironment("", directory);
     Assert.That(environment.ProjectName, Is.EqualTo(""));
 }
Esempio n. 3
0
 public void Should_default_to_the_current_executing_directory_when_not_supplied()
 {
     using (Record)
     {
         SetupResult.For(fileSystem.CurrentDirectory).Return(@"c:\work\is\fun");
     }
     using (Playback)
     {
         IProjectEnvironment environment = new ProjectEnvironment("", @"c:\work\is\fun");
         Assert.That(environment.ProjectDirectory, Is.EqualTo(fileSystem.CurrentDirectory));
     }
 }
Esempio n. 4
0
 public void Should_join_current_working_directory_with_supplied_directory_when_supplied_directory_is_not_absolute()
 {
     string directory = @"c:\work";
     string projectName = "test";
     using (Record)
     {
         SetupResult.For(fileSystem.CurrentDirectory).Return(directory);
         SetupResult.For(fileSystem.IsRooted(projectName)).Return(false);
         SetupResult.For(fileSystem.Combine(directory, projectName)).Return(@"c:\work\test");
     }
     using (Playback)
     {
         IProjectEnvironment environment = new ProjectEnvironment(projectName, directory);
         Assert.That(environment.ProjectDirectory, Is.EqualTo(@"c:\work"));
     }
 }
Esempio n. 5
0
        public void Execute(IEnumerable<IArgument> arguments)
        {
            IProjectEnvironment projectEnvironment = new ProjectEnvironment(ProjectName, Directory);
            IProjectEnvironment templateEnvironment = new ProjectEnvironment(string.Empty,
                                                                            BuildTemplateDirectory(), true);

            try
            {
                if (!_projectManifestRepository.ManifestExists(projectEnvironment))
                {
                    IProjectManifest templateManifest = _projectManifestRepository.LoadProjectManifest(templateEnvironment);
                    _pipeline.Process(templateManifest, projectEnvironment, templateEnvironment);
                    _projectManifestRepository.SaveProjectManifest(templateManifest, projectEnvironment);
                }
            }
            catch(FileNotFoundException ex)
            {
                _console.WriteError(ex.Message);
            }
        }
Esempio n. 6
0
 public void Should_provide_the_last_folder_name_for_the_project_name_when_using_the_default_executing_directory()
 {
     using (Record)
     {
         SetupResult.For(fileSystem.DirectorySeparatorChar).Return(Path.DirectorySeparatorChar);
         SetupResult.For(fileSystem.CurrentDirectory).Return(@"c:\work\is\fun");
     }
     using (Playback)
     {
         IProjectEnvironment environment = new ProjectEnvironment("", @"c:\work\is\fun");
         Assert.That(environment.ProjectName, Is.EqualTo(""));
     }
 }