[Test] public void API_Nuget_Ctor()
        {
            var apiNuGet = new API_NuGet();

            apiNuGet.NuGet_Exe.assert_Not_Null();
            apiNuGet.NuGet_Exe_Download_Uri.assert_Not_Null();
        }
        [Test] 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");
        }
        [Test] public void has_Package()
        {
            var packageName = "FluentSharp.CoreLib";
            var nuGet       = new API_NuGet();

            nuGet.install(packageName);
            nuGet.has_Package(packageName).assert_True();
        }
        [Test] public void list()
        {
            var nuGet = new API_NuGet();

            nuGet.list("FluentSharp").assert_Not_Empty()
            .assert_Size_Is(28)
            .assert_Equal_To(nuGet.packages_FluentSharp());
        }
 [Test] 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();
 }
        [Test] 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);
        }
Exemple #7
0
        [Test] 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());
        }
Exemple #8
0
        [Test] 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"));
        }
        [Test] public void list()
        {
			if (clr.mono ())
				"Same prob as help() method".assert_Ignore ();
            
            var nuGet = new API_NuGet();

            //Console.WriteLine("-------");
            //Console.WriteLine(nuGet.list("FluentSharp").asString());
            //Console.WriteLine("-------");
            //Console.WriteLine(nuGet.packages_FluentSharp().asString());
            //Console.WriteLine("-------");

            nuGet.list("FluentSharp").assert_Not_Empty()                                     
                                     .assert_Equal_To(nuGet.packages_FluentSharp());
        }
        [Test] 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();
        }
        [Test] 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();
        }
        [Test] 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();
        }
 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);
 }
Exemple #14
0
 public void FixtureSetup()
 {
     apiNuGet = new API_NuGet();
 }