Example #1
0
        public void requests_for_a_single_dependency_in_multiple_groups()
        {
            var g1 = new DependencyGroup();

            g1.Add(new GroupedDependency("FubuCore"));
            g1.Add(new GroupedDependency("FubuLocalization"));
            theSolution.AddGroup(g1);

            var g2 = new DependencyGroup();

            g2.Add(new GroupedDependency("FubuLocalization"));
            g2.Add(new GroupedDependency("Bottles"));
            theSolution.AddGroup(g2);

            theInput.NugetFlag = "FubuCore";

            var requests = theInput.Requests(theSolution).ToArray();

            requests[0].Dependency.ShouldEqual(new Dependency("FubuCore"));
            requests[0].Batched.ShouldBeFalse();

            requests[1].Dependency.ShouldEqual(new Dependency("FubuLocalization"));
            requests[1].Batched.ShouldBeFalse();

            requests[2].Dependency.ShouldEqual(new Dependency("Bottles"));
            requests[2].Batched.ShouldBeFalse();
        }
        public void has_dependency_negative()
        {
            var group = new DependencyGroup();

            group.Add(new GroupedDependency("FubuCore"));

            group.Has("Bottles").ShouldBeFalse();
        }
        public void has_dependency_case_insensitive()
        {
            var group = new DependencyGroup();

            group.Add(new GroupedDependency("FubuCore"));

            group.Has("fubuCore").ShouldBeTrue();
        }
Example #4
0
        public void requests_for_a_single_dependency_in_a_group()
        {
            var group = new DependencyGroup();

            group.Add(new GroupedDependency("FubuCore"));
            group.Add(new GroupedDependency("FubuLocalization"));

            theSolution.AddGroup(group);
            theInput.NugetFlag = "FubuCore";

            var requests = theInput.Requests(theSolution).ToArray();

            requests[0].Dependency.ShouldEqual(new Dependency("FubuCore"));
            requests[0].Batched.ShouldBeFalse();

            requests[1].Dependency.ShouldEqual(new Dependency("FubuLocalization"));
            requests[1].Batched.ShouldBeFalse();
        }
Example #5
0
        public List <DependencyGroup> Sort(HashSet <State> states)
        {
            HashSet <Node> leafs;

            Collapse(states, out leafs);

            var ret = new List <DependencyGroup>();

            var q = new Queue();

            // Add all leaf nodes (nothing depends on them) to the initial set
            foreach (var n in leafs)
            {
                q.Enqueue(n);
            }

            while (!q.Empty)
            {
                var n = q.Dequeue();

                // Append the node to the last group if it has the same
                // embedding
                if (ret.Count != 0 && ret[ret.Count - 1].Embedding == n.Embedding && ret[ret.Count - 1].EventStateGroup == n.EventStateGroup)
                {
                    ret[ret.Count - 1].Add(n.State);
                }
                else
                {
                    // Otherwise create a new group for it and append the group
                    // to the resulting set
                    DependencyGroup g = new DependencyGroup(n.Embedding, n.EventStateGroup);
                    g.Add(n.State);

                    ret.Add(g);
                }

                // Iterate over all the nodes (dep) that depend on (n)
                foreach (var dep in n.DependencyFor)
                {
                    // Remove the node from its dependencies (it has been
                    // processed)
                    dep.Dependencies.Remove(n);

                    // If this list is now 0, then (dep) does not have any
                    // dependencies left and can be added to our queue to be
                    // inserted in the result
                    if (dep.Dependencies.Count == 0 && dep.State != null)
                    {
                        q.Enqueue(dep);
                    }
                }
            }

            // TODO: check for cyclic dependencies
            return(ret);
        }
Example #6
0
            public void GroupDependencies(params string[] dependencies)
            {
                Modify(solution =>
                {
                    var group = new DependencyGroup {
                        Name = dependencies.First()
                    };
                    dependencies.Each(x => group.Add(new GroupedDependency(x)));

                    solution.AddGroup(group);
                });
            }
        public void persists_and_retrieves_the_solution()
        {
            var solution = new Solution
            {
                Name   = "Test",
                Feeds  = new[] { Feed.NuGetV2, Feed.NuGetV1 },
                Nugets = new[] { new Dependency("FubuCore", "1.0.1.0") }
            };

            var group = new DependencyGroup {
                Name = "Test"
            };

            group.Add(new GroupedDependency("FubuCore"));
            solution.AddGroup(group);

            solution.AddDependency(new Dependency("Bottles", "1.0.0.0")
            {
                VersionConstraint = VersionConstraint.DefaultFloat
            });

            solution.AddNuspec(new NuspecMap {
                PackageId = "Temp", PublishedBy = "Test"
            });

            solution.Ignore("Rhino.ServiceBus.dll", "Esent.Interop.dll");

            var registry         = new RippleBlockRegistry();
            var solutionSettings = registry.SettingsFor(typeof(Solution));

            CheckObjectBlockPersistence
            .ForSolution(solution)
            .VerifyProperties(property =>
            {
                if (!property.CanWrite)
                {
                    return(false);
                }

                if (solutionSettings.ShouldIgnore(solution, new SingleProperty(property)))
                {
                    return(false);
                }

                return(true);
            });
        }