Exemplo n.º 1
0
        public void MissingDependenciesAreIgnored()
        {
            var testProvider = new TestDependencyProvider()
                .Package("a", "1.0", that => that.Needs("x", "1.0"));

            var walker = new DependencyWalker(new[] { testProvider });
            walker.Walk("a", new SemanticVersion("1.0"), VersionUtility.ParseFrameworkName("net45"));

            AssertDependencies(testProvider.Dependencies, that => that
                .Needs("a", "1.0"));
        }
Exemplo n.º 2
0
        public void NestedGraphCanBeWalked()
        {
            var testProvider = new TestDependencyProvider()
                .Package("a", "1.0", that => that.Needs("b", "1.0").Needs("c", "1.0"))
                .Package("b", "1.0", that => that.Needs("c", "1.0").Needs("d", "1.0"))
                .Package("c", "1.0")
                .Package("d", "1.0");

            var walker = new DependencyWalker(new[] { testProvider });
            walker.Walk("a", new SemanticVersion("1.0"), VersionUtility.ParseFrameworkName("net45"));

            AssertDependencies(testProvider.Dependencies, that => that
                .Needs("a", "1.0")
                .Needs("b", "1.0")
                .Needs("c", "1.0")
                .Needs("d", "1.0"));
        }
Exemplo n.º 3
0
        public void HigherDisputedDependencyWins()
        {
            var testProvider = new TestDependencyProvider()
                               .Package("a", "1.0", that => that.Needs("b", "1.0").Needs("c", "1.0"))
                               .Package("b", "1.0", that => that.Needs("x", "1.0"))
                               .Package("c", "1.0", that => that.Needs("x", "2.0"))
                               .Package("x", "1.0")
                               .Package("x", "2.0");

            var walker = new DependencyWalker(new[] { testProvider });

            walker.Walk("a", new SemanticVersion("1.0"), VersionUtility.ParseFrameworkName("net45"));

            AssertDependencies(testProvider.Dependencies, that => that
                               .Needs("a", "1.0")
                               .Needs("b", "1.0")
                               .Needs("c", "1.0")
                               .Needs("x", "2.0"));
        }
Exemplo n.º 4
0
        public void NearestDependencyVersionWins()
        {
            var testProvider = new TestDependencyProvider()
                               .Package("a", "1.0", that => that.Needs("b", "1.0").Needs("c", "1.0").Needs("x", "1.0"))
                               .Package("b", "1.0", that => that.Needs("x", "2.0"))
                               .Package("c", "1.0", that => that.Needs("x", "2.0"))
                               .Package("x", "1.0")
                               .Package("x", "2.0");

            var walker = new DependencyWalker(new[] { testProvider });

            walker.Walk("a", new SemanticVersion("1.0"), VersionUtility.ParseFrameworkName("net45"));

            testProvider.Dependencies.ShouldBe(Dependencies(that => that
                                                            .Needs("a", "1.0")
                                                            .Needs("b", "1.0")
                                                            .Needs("c", "1.0")
                                                            .Needs("x", "1.0")
                                                            ));
        }
Exemplo n.º 5
0
        public void RejectedDependenciesToNotCarryConstraints()
        {
            // a1->b1-*d1->e2->x2
            // a1->c1->d2
            // a1->c1->e1->x1
            // * b1->d1 lower than c1->d2 so d1->e2->x2 are n/a

            var testProvider = new TestDependencyProvider()
                .Package("a", "1.0", that => that.Needs("b", "1.0").Needs("c", "1.0"))
                .Package("b", "1.0", that => that.Needs("d", "1.0"))
                .Package("c", "1.0", that => that.Needs("d", "2.0").Needs("e", "1.0"))
                .Package("d", "1.0", that => that.Needs("e", "2.0"))
                .Package("d", "2.0")
                .Package("e", "1.0", that => that.Needs("x", "1.0"))
                .Package("e", "2.0", that => that.Needs("x", "2.0"))
                .Package("x", "1.0")
                .Package("x", "2.0")
                .Package("g", version: null);

            var walker = new DependencyWalker(new[] { testProvider });
            walker.Walk("a", new SemanticVersion("1.0"), VersionUtility.ParseFrameworkName("net45"));

            // the d1->e2->x2 line has no effect because d2 has no dependencies,

            AssertDependencies(testProvider.Dependencies, that => that
                .Needs("a", "1.0")
                .Needs("b", "1.0")
                .Needs("c", "1.0")
                .Needs("d", "2.0")
                .Needs("e", "1.0")
                .Needs("x", "1.0"));
        }
Exemplo n.º 6
0
        public void RecursiveDependenciesAreNotFollowed()
        {
            var testProvider = new TestDependencyProvider()
                .Package("a", "1.0", that => that.Needs("b", "1.0"))
                .Package("b", "1.0", that => that.Needs("c", "1.0"))
                .Package("c", "1.0", that => that.Needs("d", "1.0").Needs("b", "1.0"))
                .Package("d", "1.0", that => that.Needs("b", "1.0"));

            var walker = new DependencyWalker(new[] { testProvider });

            Assert.Throws<InvalidOperationException>(() =>
            {
                walker.Walk("a", new SemanticVersion("1.0"), VersionUtility.ParseFrameworkName("net45"));
            });
        }