public void NonExistentPath_Throws() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>(), _someOtherPath); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act // Assert var exception = Assert.Throws <CommandValidationException>(() => projectDiscoveryService.DiscoverProjects(_path)); Assert.Equal(string.Format(ValidationErrorMessages.DirectoryOrFileDoesNotExist, _path), exception.Message); }
public void SingleProject_ReturnsFsProject() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { _project3, MockFileData.NullObject } }, _path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act string project = projectDiscoveryService.DiscoverProjects(_path).Single(); // Assert Assert.Equal(_project3, project); }
public void SingleSolution_ReturnsSolution() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { _solution1, MockFileData.NullObject } }, _path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act string project = projectDiscoveryService.DiscoverProject(_path); // Assert Assert.Equal(project, _solution1); }
public void SingleProject_ReturnsProject() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { Project1, MockFileData.NullObject } }, Path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act string project = projectDiscoveryService.DiscoverProject(Path); // Assert Assert.Equal(project, Project1); }
public void SingleSolutionFilter_ReturnsSolution() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { _solutionFilter1, MockFileData.NullObject } }, _path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act var projects = projectDiscoveryService.DiscoverProjects(_path); // Assert Assert.Single(projects); Assert.Equal(_solutionFilter1, projects.First()); }
public void NonSolution_Throws() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { _nonProjectFile, MockFileData.NullObject } }, _path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act // Assert var exception = Assert.Throws <CommandValidationException>(() => projectDiscoveryService.DiscoverProjects(_nonProjectFile)); Assert.Equal(string.Format(ValidationErrorMessages.FileNotAValidSolutionOrProject, _nonProjectFile), exception.Message); }
public void NoSolutionsOrProjects_Throws() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { _nonProjectFile, MockFileData.NullObject } }, _path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act // Assert var exception = Assert.Throws <CommandValidationException>(() => projectDiscoveryService.DiscoverProject(_path)); Assert.Equal(exception.Message, string.Format(Resources.ValidationErrorMessages.DirectoryDoesNotContainSolutionsOrProjects, _path)); }
public void MultipleProjects_Throws() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { _project1, MockFileData.NullObject }, { _project2, MockFileData.NullObject } }, _path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act // Assert var exception = Assert.Throws <CommandValidationException>(() => projectDiscoveryService.DiscoverProjects(_path)); Assert.Equal(string.Format(ValidationErrorMessages.DirectoryContainsMultipleProjects, _path), exception.Message); }
public void MultipleSolutions_Throws() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { Solution1, MockFileData.NullObject }, { Solution2, MockFileData.NullObject } }, Path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act // Assert var exception = Assert.Throws <CommandValidationException>(() => projectDiscoveryService.DiscoverProject(Path)); Assert.Equal(exception.Message, string.Format(Resources.ValidationErrorMessages.DirectoryContainsMultipleSolutions, Path)); }
public void MultipleProjectsRecursive_ReturnsProjects() { // Arrange var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { _project1, MockFileData.NullObject }, { _project3, MockFileData.NullObject }, { _project4, MockFileData.NullObject } }, _path); var projectDiscoveryService = new ProjectDiscoveryService(fileSystem); // Act // Assert var projects = projectDiscoveryService.DiscoverProjects(_path, true); Assert.Equal(3, projects.Count); }