コード例 #1
0
        public void can_get_all_local_packages_from_a_directory_of_unpacked_packages()
        {
            var packages = LocalPackage.FromDirectory(PathToContent("unpacked_packages"));

            packages.Count.ShouldEqual(8);
            foreach (var idAndVersion in new string[] { "AntiXSS-4.0.1", "Castle.Core-1.1.0", "Castle.Core-1.2.0", "Castle.Core-2.5.1",
                                                        "Ninject-2.0.1.0", "Ninject-2.1.0.76", "RestfulRouting-1.0", "RhinoMocks-3.6" })
            {
                packages.Select(pkg => pkg.IdAndVersion).ShouldContain(idAndVersion);
            }

            var ninject = packages.First(pkg => pkg.IdAndVersion == "Ninject-2.0.1.0");

            // check some generic Package properties
            ninject.Id.ShouldEqual("Ninject");
            ninject.VersionText.ShouldEqual("2.0.1.0");

            // check LocalPackage specific properties/methods
            ninject.Path.ShouldEqual(PathToContent("unpacked_packages", "Ninject-2.0.1.0"));
            ninject.NuspecPath.ShouldEqual(PathToContent("unpacked_packages", "Ninject-2.0.1.0", "Ninject.nuspec"));
            ninject.Libraries.ShouldEqual(new string[] { PathToContent("unpacked_packages", "Ninject-2.0.1.0", "lib", "Ninject.dll") });
            ninject.Tools.Should(Be.Empty);
            ninject.Content.Should(Be.Empty);

            // getting arbitrary files
            ninject.GetFiles().Length.ShouldEqual(4);
            ninject.GetFiles("lib").Length.ShouldEqual(2);
            ninject.GetFiles("lib", "*.dll").Length.ShouldEqual(1);
            ninject.GetFiles("tools").Length.ShouldEqual(0);
        }
コード例 #2
0
        public void can_get_all_exe_tools()
        {
            var package = LocalPackage.FromDirectory(PathToContent("packages")).First(pkg => pkg.Id == "NUnit");

            package.ToolsDirectory.ShouldEqual(Path.Combine(package.Path, "Tools"));
            package.Tools.Length.ShouldEqual(9);

            var exeNames = package.Tools.Select(path => Path.GetFileName(path));

            foreach (var exe in new string[] { "nunit-agent-x86.exe", "nunit-agent.exe", "nunit-console-x86.exe", "nunit-console.exe", "nunit-x86.exe", "nunit.exe", "pnunit-agent.exe", "pnunit-launcher.exe", "runFile.exe" })
            {
                exeNames.ShouldContain(exe);
            }
        }