示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#5
0
        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());
        }
示例#6
0
        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);
        }
示例#7
0
        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));
        }
示例#8
0
        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));
        }
示例#10
0
        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);
        }