public void SetUp()
        {
            theFinder = MockRepository.GenerateStub<INuspecTemplateFinder>();
            
            theSolution = new Solution();
            theSolution.AddProject("Project1");
            theSolution.AddProject("Project2");

            d1 = new NuspecDependencyToken("DependencyA", "1.0.0.0", VersionConstraint.DefaultFixed);
            d2 = new NuspecDependencyToken("DependencyB", "1.0.0.0", VersionConstraint.DefaultFixed);

            g1 = new NuspecTemplate(new NugetSpec("Spec1", "Spec1.nuspec"), new[] { ProjectNuspec.For(theSolution.FindProject("Project1")) });
            g2 = new NuspecTemplate(new NugetSpec("Spec2", "Spec2.nuspec"), new[] { ProjectNuspec.For(theSolution.FindProject("Project2")) });

            theTemplates = new NuspecTemplateCollection(new[] { g1, g2 });

            src1 = MockRepository.GenerateStub<INuspecDependencySource>();
            src2 = MockRepository.GenerateStub<INuspecDependencySource>();

            theFinder.Stub(x => x.Templates(theSolution)).Return(theTemplates);

            src1.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g1, theTemplates, theSolution))).Return(new[] { d1 });
            src1.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g2, theTemplates, theSolution))).Return(new NuspecDependencyToken[0]);

            src2.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g1, theTemplates, theSolution))).Return(new NuspecDependencyToken[0]);
            src2.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g2, theTemplates, theSolution))).Return(new[] { d2 });

            theGenerator = new NuspecGenerator(theFinder, new[] { src1, src2 });
            thePlan = theGenerator.PlanFor(theSolution, new SemanticVersion("1.0.0.0"));
        }
Exemple #2
0
        public NuspecGenerationPlan PlanFor(Solution solution, SemanticVersion version)
        {
            var plan      = new NuspecGenerationPlan(solution, version);
            var templates = _finder.Templates(solution);

            templates.Each(template =>
            {
                var child   = new NuspecPlan(template, version);
                var context = new NuspecTemplateContext(template, templates, solution, version);

                child.AddDependencies(_sources.SelectMany(x => x.DetermineDependencies(context)));

                plan.Add(child);
            });

            return(plan);
        }
        public NuspecGenerationPlan PlanFor(Solution solution, SemanticVersion version)
        {
            var plan = new NuspecGenerationPlan(solution, version);
            var templates = _finder.Templates(solution);

            templates.Each(template =>
            {
                var child = new NuspecPlan(template, version);
                var context = new NuspecTemplateContext(template, templates, solution, version);

                child.AddDependencies(_sources.SelectMany(x => x.DetermineDependencies(context)));

                plan.Add(child);
            });

            return plan;
        }