public void Nothing_is_found_when_dependencies_match()
        {
            // Arrange
            var nuspecFile = new NuSpecFile
            {
                PackageDependencies = new[]
                        {
                            new NuGetPackageDependency{Id = "P1",Version = "v1"},
                            new NuGetPackageDependency{Id = "P2",Version = "v1"}
                        }
            };
            var projects = new[]
                {
                    new Project
                        {
                            PackageDependencies = new[]
                                {
                                    new NuGetPackageDependency {Id = "P1", Version = "v1"},
                                    new NuGetPackageDependency {Id = "P2", Version = "v1"}
                                }
                        }
                };

            var request = new NuSpecValidationRequest { NuSpecFile = nuspecFile, Projects = projects };

            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(request).ToList();

            // Assert
            Assert.That(results, Is.Empty);
        }
        public void Each_unnecessary_dependency_is_shown_then_they_do_not_match()
        {
            // Arrange
            var nuspecFile = new NuSpecFile
            {
                PackageDependencies = new[]
                        {
                            new NuGetPackageDependency{Id = "P1",Version = "v1"},
                            new NuGetPackageDependency{Id = "P2",Version = "v1"},
                            new NuGetPackageDependency{Id = "P3",Version = "v2"}
                        }
            };
            var projects = new[]
                {
                    new Project
                        {
                            PackageDependencies = new[]
                                {
                                    new NuGetPackageDependency {Id = "P1", Version = "v1"}
                                }
                        }
                };

            var request = new NuSpecValidationRequest { NuSpecFile = nuspecFile, Projects = projects };

            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(request).ToList();

            // Assert
            Assert.That(results.Count, Is.EqualTo(2));
            Assert.That(results.First().Message,Is.StringContaining("P2"));
            Assert.That(results.Last().Message, Is.StringContaining("P3"));
        }
        public void Nuspec_files_do_not_contain_unnecessary_dependencies()
        {
            // Arrange
            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(_solution).ToList();

            // Assert
            Assert.AreEqual(results.Count, 0, GetFailureMessage(results));
        }
        public void Nuspec_files_do_not_contain_unnecessary_dependencies()
        {
            // Arrange
            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(_solution);

            // Assert
            Assert.That(results, Is.Empty, GetFailureMessage(results));
        }
Esempio n. 5
0
        public void Nuspec_files_do_not_contain_unnecessary_dependencies()
        {
            // Arrange
            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(_solution).ToList();

            // Assert
            Assert.AreEqual(results.Count, 0, GetFailureMessage(results));
        }
Esempio n. 6
0
        public void Nuspec_files_do_not_contain_unnecessary_dependencies()
        {
            // Arrange
            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(_solution);

            // Assert
            Assert.That(results, Is.Empty, GetFailureMessage(results));
        }
        public void Each_unnecessary_dependency_is_shown_then_they_do_not_match()
        {
            // Arrange
            var nuspecFile = new NuSpecFile
            {
                PackageDependencies = new[]
                {
                    new NuGetPackageDependency {
                        Id = "P1", Version = "v1"
                    },
                    new NuGetPackageDependency {
                        Id = "P2", Version = "v1"
                    },
                    new NuGetPackageDependency {
                        Id = "P3", Version = "v2"
                    }
                }
            };
            var projects = new[]
            {
                new Project
                {
                    PackageDependencies = new[]
                    {
                        new NuGetPackageDependency {
                            Id = "P1", Version = "v1"
                        }
                    }
                }
            };

            var request = new NuSpecValidationRequest {
                NuSpecFile = nuspecFile, Projects = projects
            };

            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(request).ToList();

            // Assert
            Assert.That(results.Count, Is.EqualTo(2));
            Assert.That(results.First().Message, Is.StringContaining("P2"));
            Assert.That(results.Last().Message, Is.StringContaining("P3"));
        }
        public void Nothing_is_found_when_dependencies_match_and_there_is_a_project_dependency()
        {
            // Arrange
            var nuspecFile = new NuSpecFile
            {
                PackageDependencies = new[]
                {
                    new NuGetPackageDependency {
                        Id = "P1", Version = "v1"
                    },
                    new NuGetPackageDependency {
                        Id = "P2", Version = "v1"
                    }
                }
            };
            var projects = new[]
            {
                new Project
                {
                    PackageDependencies = new[]
                    {
                        new NuGetPackageDependency {
                            Id = "P1", Version = "v1"
                        },
                    }
                },
                new Project {
                    Name = "P2", PackageDependencies = new NuGetPackageDependency[0]
                }
            };

            var request = new NuSpecValidationRequest {
                NuSpecFile = nuspecFile, Projects = projects
            };

            var validator = new NuSpecContainsOnlyRequiredDependenciesValidator();

            // Act
            var results = validator.Validate(request).ToList();

            // Assert
            Assert.That(results, Is.Empty);
        }