public void lists_locally_installed_packaged_if_no_args_passed() { mooDir.Packages.Count.ShouldEqual(0); var output = moo("list"); output.ShouldEqual("No packages"); output.ShouldNotContain("MarkdownSharp"); mooDir.Install(new PackageDependency("MarkdownSharp"), source1); mooDir.Packages.Count.ShouldEqual(1); output = moo("list"); output.ShouldContain("MarkdownSharp"); output.ShouldContain("1.13.0.0"); // version }
public void Install() { Directory.CreateDirectory(PathToTemp("mydir")); var mydir = new MooDir(PathToTemp("mydir")).Initialize(); mydir.Packages.Should(Be.Empty); // if we don't provide any sources, it can't find the package we're talking about ... Should.Throw <PackageNotFoundException>("Package not found: FluentNHibernate", () => { mydir.Install(new PackageDependency("FluentNHibernate")); }); // we find the package we're talking about, but we're missing one of the dependencies Should.Throw <MissingDependencyException>("No packages were found that satisfy these dependencies: Iesi.Collections >= 1.0.1, Castle.DynamicProxy >= 2.1.0", () => { mydir.Install(new PackageDependency("FluentNHibernate"), morePackages); }); mydir.Packages.Should(Be.Empty); // check the dependencies that we're going to install (assuming Install() calls FindDependencies) var dependencies = Source.FindDependencies(morePackages.Get(new PackageDependency("FluentNHibernate")), morePackages, morePackageDependencies); dependencies.Count.ShouldEqual(6); dependencies.Select(pkg => pkg.IdAndVersion()).ToList().ShouldContainAll( "NHibernate-2.1.2.4000", "log4net-1.2.10", "Iesi.Collections-1.0.1", "Antlr-3.1.1", "Castle.DynamicProxy-2.1.0", "Castle.Core-1.1.0", "log4net-1.2.10" ); // Inspect their sources to see that some come from 1, some come from another dependencies.First(d => d.Id == "NHibernate").Source.ShouldEqual(morePackages); dependencies.First(d => d.Id == "log4net").Source.ShouldEqual(morePackages); dependencies.First(d => d.Id == "Antlr").Source.ShouldEqual(morePackages); dependencies.First(d => d.Id == "Castle.Core").Source.ShouldEqual(morePackages); dependencies.First(d => d.Id == "Iesi.Collections").Source.ShouldEqual(morePackageDependencies); dependencies.First(d => d.Id == "Castle.DynamicProxy").Source.ShouldEqual(morePackageDependencies); mydir.Install(new PackageDependency("FluentNHibernate"), morePackages, morePackageDependencies); mydir.Packages.Count.ShouldEqual(7); mydir.Packages.Select(pkg => pkg.IdAndVersion()).ToList().ShouldContainAll( "NHibernate-2.1.2.4000", "log4net-1.2.10", "Iesi.Collections-1.0.1", "Antlr-3.1.1", "Castle.DynamicProxy-2.1.0", "Castle.Core-1.1.0", "FluentNHibernate-1.1.0.694" ); }
public void Uninstall_with_dependencies() { Directory.CreateDirectory(PathToTemp("mydir")); var mydir = new MooDir(PathToTemp("mydir")).Initialize(); mydir.Install(new PackageDependency("FluentNHibernate"), morePackages, morePackageDependencies); mydir.Packages.Count.ShouldEqual(7); mydir.Packages.Select(pkg => pkg.IdAndVersion()).ToList().ShouldContainAll( "NHibernate-2.1.2.4000", "log4net-1.2.10", "Iesi.Collections-1.0.1", "Antlr-3.1.1", "Castle.DynamicProxy-2.1.0", "Castle.Core-1.1.0", "FluentNHibernate-1.1.0.694" ); mydir.Uninstall(new PackageDependency("FluentNHibernate"), true).Should(Be.True); mydir.Packages.Count.ShouldEqual(0); mydir.Uninstall(new PackageDependency("FluentNHibernate"), true).Should(Be.False); mydir.Packages.Count.ShouldEqual(0); }