public void Can_check_if_a_file_exists_in_project() { var project = new VisualStudioProjectFacade(SampleProject); project.Includes("Content/Site.css").ShouldBe(true); project.Includes("Global.asax").ShouldBe(true); project.Includes("BLAH_BLAH.txt").ShouldBe(false); project.Includes("Malware").ShouldBe(false); }
public void Can_include_a_folder_into_existing_project() { var project = new VisualStudioProjectFacade(SampleProject); project.Includes("Content/Images").ShouldBe(false); project.IncludeDirectory("Content/Images"); project.Includes("Content/Images").ShouldBe(true); }
public void Including_a_folder_that_does_not_exist_should_throw() { var project = new VisualStudioProjectFacade(SampleProject); Should.Throw<InvalidOperationException>(() => project.IncludeDirectory("Content/IDontExist") ); }
protected override void ProcessRecord() { var currentProject = _solutionManager.DefaultProject; var workingDirectory = Path.Combine(Path.GetDirectoryName(currentProject.FullName), "Content"); var compassBridge = new CompassRuntime(); var text = compassBridge.ExecuteCommandLine(workingDirectory, Command); var project = new VisualStudioProjectFacade(currentProject); foreach (var line in text) { if (line.Trim().StartsWith("directory")) { var directory = "Content/" + line.Split(' ')[1]; if (!project.Includes(directory)) { project.IncludeDirectory(directory); } } else if (line.Trim().StartsWith("create")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if (!project.Includes(filePath)) { project.IncludeFile(filePath); } } else if (line.Trim().StartsWith("identical")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if (Path.HasExtension(filePath)) { if (!project.Includes(filePath)) { project.IncludeFile(filePath); } } else { if (!project.Includes(filePath)) { project.IncludeDirectory(filePath); } } } } WriteObject(text); }
public void Can_add_existing_file() { var project = new VisualStudioProjectFacade(SampleProject); project.Includes("Content/config.rb").ShouldBe(false); project.IncludeFile("Content/config.rb"); project.Includes("Content/config.rb").ShouldBe(true); }
public void Can_check_for_path_that_does_not_exist() { var project = new VisualStudioProjectFacade(SampleProject); project.Includes("Content/IDontExist").ShouldBe(false); }
protected override void ProcessRecord() { var currentProject = _solutionManager.DefaultProject; var workingDirectory = Path.Combine(Path.GetDirectoryName(currentProject.FullName), "Content"); var compassBridge = new CompassRuntime(); var text = compassBridge.ExecuteCommandLine(workingDirectory, Command); var project = new VisualStudioProjectFacade(currentProject); foreach (var line in text) { if (line.Trim().StartsWith("directory")) { var directory = "Content/" + line.Split(' ')[1]; if (!project.Includes(directory)) { project.IncludeDirectory( directory); } } else if (line.Trim().StartsWith("create")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if(!project.Includes(filePath)) { project.IncludeFile( filePath); } } else if (line.Trim().StartsWith("identical")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if (Path.HasExtension(filePath)) { if (!project.Includes(filePath)) { project.IncludeFile( filePath); } } else { if (!project.Includes(filePath)) { project.IncludeDirectory(filePath); } } } } WriteObject(text); }