From fed823d446689b449cdc827d721c9fe85897c51e Mon Sep 17 00:00:00 2001 From: Gauthier Segay Date: Sat, 23 Apr 2016 20:32:08 +0200 Subject: [PATCH] integration test when framework is specified --- .../LoadingScriptGenerationTests.fs | 38 ++++++++++++++++++- .../before/paket.dependencies | 4 ++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 integrationtests/scenarios/loading-scripts-scenarios/framework-specified/before/paket.dependencies diff --git a/integrationtests/Paket.IntegrationTests/LoadingScriptGenerationTests.fs b/integrationtests/Paket.IntegrationTests/LoadingScriptGenerationTests.fs index 92460ce308..e82a37a033 100644 --- a/integrationtests/Paket.IntegrationTests/LoadingScriptGenerationTests.fs +++ b/integrationtests/Paket.IntegrationTests/LoadingScriptGenerationTests.fs @@ -1,7 +1,8 @@ module Paket.IntegrationTests.LoadingScriptGenerationTests +open System +open System.IO open NUnit.Framework open Paket.IntegrationTests.TestHelpers -open System.IO open Paket let makeScenarioPath scenario = Path.Combine("loading-scripts-scenarios", scenario) @@ -22,7 +23,6 @@ let ``simple dependencies generates expected scripts``() = let framework = "net4" paket "install" scenario |> ignore - directPaket (sprintf "generate-include-scripts framework %s" framework) scenario |> ignore let files = getGeneratedScriptFiles framework scenario @@ -37,3 +37,37 @@ let ``simple dependencies generates expected scripts``() = |] Assert.AreEqual(expectedFiles, actualFiles) + +[] +let ``framework specified``() = + let scenario = "framework-specified" + paket "install" scenario |> ignore + + directPaket "generate-include-scripts" scenario |> ignore + + let files = + getGeneratedScriptFiles "net35" scenario + |> Seq.map (fun f -> f.Name, f) + |> dict + + let expectations = [ + "include.iesi.collections.csx", ["Net35/Iesi.Collections.dll"] + "include.iesi.collections.fsx", ["Net35/Iesi.Collections.dll"] + "include.nhibernate.csx", ["Net35/NHibernate.dll";"#load \"include.iesi.collections.csx\""] + "include.nhibernate.fsx", ["Net35/NHibernate.dll";"#load @\"include.iesi.collections.fsx\""] + ] + + let failures = seq { + for (file, contains) in expectations do + match files.TryGetValue file with + | false, _ -> yield sprintf "file %s was not found" file + | true, file -> + let text = file.FullName |> File.ReadAllText + for expectedText in contains do + if not (text.Contains expectedText) then + yield sprintf "file %s didn't contain %s" file.FullName expectedText + } + + if not (Seq.isEmpty failures) then + Assert.Fail (failures |> String.concat Environment.NewLine) + \ No newline at end of file diff --git a/integrationtests/scenarios/loading-scripts-scenarios/framework-specified/before/paket.dependencies b/integrationtests/scenarios/loading-scripts-scenarios/framework-specified/before/paket.dependencies new file mode 100644 index 0000000000..18b0f8767b --- /dev/null +++ b/integrationtests/scenarios/loading-scripts-scenarios/framework-specified/before/paket.dependencies @@ -0,0 +1,4 @@ +source http://nuget.org/api/v2 +framework: net35 + +nuget NHibernate ~> 3 \ No newline at end of file