Example #1
0
 public void has_Package()
 {
     var packageName = "FluentSharp.CoreLib";
     var nuGet = new API_NuGet();
     nuGet.install(packageName);
     nuGet.has_Package(packageName).assert_True();
 }
Example #2
0
        public void API_Nuget_Ctor()
        {
            var apiNuGet = new API_NuGet();

            apiNuGet.NuGet_Exe             .assert_Not_Null();
            apiNuGet.NuGet_Exe_Download_Uri.assert_Not_Null();
        }
Example #3
0
        public static string install(this API_NuGet nuGet, string packageName)
        {
            var installMessage   = nuGet.execute("install " + packageName);
            var installedPackage = nuGet.extract_Installed_PackageName(installMessage);

            return(nuGet.NuGet_Exe.parentFolder().mapPath(installedPackage));
        }
Example #4
0
 public void install()
 {
     var nuGet = new API_NuGet();
     nuGet.install("FluentSharp.CoreLib").assert_Not_Null()         .assert_Folder_Exists()
                                         .pathCombine(@"lib").pathCombine("net35").assert_Folder_Exists()
                                         .files().first().fileName().assert_Is_Equal_To  ("FluentSharp.CoreLib.dll");
 }
Example #5
0
        public void list()
        {
            var nuGet = new API_NuGet();

            nuGet.list("FluentSharp").assert_Not_Empty()
                                     .assert_Size_Is(28)
                                     .assert_Equal_To(nuGet.packages_FluentSharp());
        }
Example #6
0
 public void path_Package()
 {
     var packageName = "FluentSharp.CoreLib";
     var nuGet = new API_NuGet();
     nuGet.install(packageName);
     nuGet.path_Package(packageName).assert_Not_Null()
                                    .assert_Contains(packageName)
                                    .assert_Folder_Exists();
 }
Example #7
0
 public static API_NuGet setup(this API_NuGet nuGet)
 {
     if (nuGet.NuGet_Exe.file_Doesnt_Exist())
     {
         nuGet.NuGet_Exe.parentFolder().createDir();
         new O2Kernel_Web().downloadBinaryFile(nuGet.NuGet_Exe_Download_Uri.str(), nuGet.NuGet_Exe);
     }
     return(nuGet.NuGet_Exe.fileExists() ? nuGet : null);
 }
Example #8
0
        public void extract_Installed_PackageName()
        {
            var nuGet = new API_NuGet();

            var message1 = @"Installing 'FluentSharp.CoreLib 5.5.172'.
            Successfully installed 'FluentSharp.CoreLib 5.5.172'.";
            var message2 = "'FluentSharp.CoreLib 5.5.172' already installed.";

            var expectedName = "FluentSharp.CoreLib.5.5.172";

            nuGet.extract_Installed_PackageName(message1).assert_Is(expectedName);
            nuGet.extract_Installed_PackageName(message2).assert_Is(expectedName);
        }
        public void mapNuGetReferences()
        {
            var targetPackage = "FluentSharp.HtmlAgilityPack";
            var nuGet = new API_NuGet("_temp_Packages_Folder".temp_Dir());

            new API_NuGet().setup().NuGet_Exe.file_CopyToFolder(nuGet.Packages_Folder);         // do this so that the nuget.exe file is not downloaded every time this unit test runs
            nuGet.NuGet_Exe.assert_File_Exists();
            nuGet.path_Package(targetPackage).assert_Null();

            nuGet.path_Package(targetPackage);
            var compilerOptions = new CSharp_FastCompiler_CompilerOptions();
            compilerOptions.ReferencedAssemblies.assert_Not_Empty();
            compilerOptions.NuGet_References.add(targetPackage);

            compilerOptions.mapNuGetReferences(nuGet);

            nuGet.path_Package(targetPackage).assert_Not_Null();
            compilerOptions.ReferencedAssemblies.contains(targetPackage);
            Files.delete_Folder_Recursively(nuGet.Packages_Folder)
                 .assert_True();
        }
Example #10
0
 public static string extract_Installed_PackageName(this API_NuGet nuGet, string installMessage)
 {
     return(installMessage.subString_After("'").subString_Before("'")
            .replace(" ", "."));
 }
Example #11
0
 public void FixtureSetup()
 {
     apiNuGet = new API_NuGet();
 }
Example #12
0
        public void setup()
        {
            var apiNuGet_Setup = new API_NuGet();

            apiNuGet_Setup.NuGet_Exe =  "_temp_NuGet".temp_Dir().path_Combine("nuget.exe");  //we need to change this, or there will be a lock on the nuget.exe (when used by another test)
            if(apiNuGet_Setup.NuGet_Exe.fileExists())
                apiNuGet_Setup.NuGet_Exe.assert_File_Deleted();

            apiNuGet_Setup.setup()  .assert_Not_Null();
            apiNuGet_Setup.NuGet_Exe.assert_File_Exists();

            apiNuGet_Setup.NuGet_Exe.assert_File_Deleted();
            apiNuGet_Setup.NuGet_Exe_Download_Uri = null;

            apiNuGet_Setup.setup() .assert_Is_Null();
            apiNuGet_Setup.NuGet_Exe.assert_File_Not_Exists();
        }
Example #13
0
 public static string resolveCompilationReferencePath(string reference)
 {
     if (CachedCompiledAssemblies.ContainsKey(reference))    // check in CachedCompiledAssemblies first
     {
         var resolvedRefernece = CachedCompiledAssemblies[reference];
         if (resolvedRefernece.fileExists())               // ensure the file is still there
             return resolvedRefernece;
         CachedCompiledAssemblies.remove(reference);
     }
     if (reference.fileExists().isFalse())
     {
         if (reference.index(",") > 0)
             reference = reference.split(",").first();
         var resolvedFile = PublicDI.CurrentScript.directoryName().pathCombine(reference);
         if (resolvedFile.fileExists())
             return resolvedFile;
         foreach (var localReferenceFolder in LocalReferenceFolders)
         {
             resolvedFile = localReferenceFolder.pathCombine(reference);
             if (resolvedFile.fileExists())
                 return resolvedFile;
             resolvedFile = localReferenceFolder.pathCombine(reference + ".dll");
             if (resolvedFile.fileExists())
                 return resolvedFile;
             resolvedFile = localReferenceFolder.pathCombine(reference + ".exe");
             if (resolvedFile.fileExists())
                     return resolvedFile;
         }
     }
     //as a final attempt try to find it on the NuGet folder
     if (reference.contains("\\").isFalse())
     {
         var nugetAssemblyFile = new API_NuGet().Packages_Folder.files(true,reference, reference+".dll",reference+".exe").first();
         if (nugetAssemblyFile.notNull())
             return nugetAssemblyFile;
     }
     return reference;
 }
 public static CSharp_FastCompiler_CompilerOptions mapNuGetReferences(this CSharp_FastCompiler_CompilerOptions compilerOptions, API_NuGet nuGet)
 {
     foreach(var nugetReference  in compilerOptions.NuGet_References)
     {
         if(nuGet.does_Not_Have_Package(nugetReference))
             nuGet.install(nugetReference);
         var assemmbliesInsideNugetPackage = nuGet.path_Package(nugetReference).files(true,"*.exe", "*.dll");
         if (assemmbliesInsideNugetPackage.empty())
             "[CSharp_FastCompiler_CompilerOptions][mapNuGetReferences] no assemblies found for Nuget package: {0}".error(nugetReference);
         compilerOptions.ReferencedAssemblies.add(assemmbliesInsideNugetPackage);
     }
     return compilerOptions;
 }
Example #15
0
        public void resolveCompilationReferencePath()
        {
            //testing NuGet assembly resolution (other parts of resolveCompilationReferencePath are missing)

            var assemblyName = "FluentSharp.HtmlAgilityPack";
            var nuGet =new API_NuGet();
            nuGet.install(assemblyName);
            nuGet.path_Package(assemblyName).assert_Folder_Exists();

            CompileEngine.resolveCompilationReferencePath(assemblyName).assert_File_Exists()
                                                                       .assert_Contains(assemblyName)
                                                                       .fileName().assert_Is(assemblyName.append(".dll"));
        }
Example #16
0
 public static bool  does_Not_Have_Package(this API_NuGet nuGet, string packageName)
 {
     return(nuGet.path_Package(packageName).folder_Not_Exists());
 }
Example #17
0
 /// <summary>
 /// Returns the path to the package name provided (note that this doesn't handle very well the package version
 /// </summary>
 /// <param name="nuGet"></param>
 /// <param name="packageName"></param>
 /// <returns></returns>
 public static string path_Package(this API_NuGet nuGet, string packageName)
 {
     return(nuGet.Packages_Folder.folders("{0}*".format(packageName)).last());
 }
Example #18
0
        public void setup()
        {
            var apiNuGet = new API_NuGet();
            if(apiNuGet.NuGet_Exe.fileExists())
                apiNuGet.NuGet_Exe.assert_File_Deleted();

            apiNuGet.setup()  .assert_Not_Null();
            apiNuGet.NuGet_Exe.assert_File_Exists();

            apiNuGet.NuGet_Exe.assert_File_Deleted();
            apiNuGet.NuGet_Exe_Download_Uri = null;

            apiNuGet.setup() .assert_Is_Null();
            apiNuGet.NuGet_Exe.assert_File_Not_Exists();
        }
Example #19
0
 public static string help(this API_NuGet nuGet)
 {
     return nuGet.execute("help");
 }
Example #20
0
 public static List <string> list(this API_NuGet nuGet, string filter)
 {
     return(nuGet.execute("list " + filter).split_onLines());
 }
Example #21
0
 public static List <string> packages_FluentSharp(this API_NuGet nuGet)
 {
     return(nuGet.list("FluentSharp"));
 }
Example #22
0
 public static bool  has_Package(this API_NuGet nuGet, string packageName)
 {
     return nuGet.path_Package(packageName).folder_Exists();
 }
Example #23
0
        public void list()
        {
            if (clr.mono ())
                "Same prob as help() method".assert_Ignore ();

            var nuGet = new API_NuGet();
            nuGet.list("FluentSharp").assert_Not_Empty()
                                     .assert_Size_Is(29)
                                     .assert_Equal_To(nuGet.packages_FluentSharp());
        }
Example #24
0
 public static string help(this API_NuGet nuGet)
 {
     return(nuGet.execute(""));
 }