diff --git a/.travis.yml b/.travis.yml index 5340e01912..0639996fa3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ language: csharp sudo: false # use the new container-based Travis infrastructure script: - - ./build.sh All + - ./build.sh RunIntegrationTests diff --git a/Paket.sln b/Paket.sln index c6df71131c..89f0e11826 100644 --- a/Paket.sln +++ b/Paket.sln @@ -77,6 +77,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "commands", "commands", "{44 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Paket.Bootstrapper.Tests", "tests\Paket.Bootstrapper.Tests\Paket.Bootstrapper.Tests.csproj", "{7C622582-E281-4EAB-AADA-B5893BB89B45}" EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Paket.IntegrationTests", "integrationtests\Paket.IntegrationTests\Paket.IntegrationTests.fsproj", "{7234B9B4-8CF5-4E68-AA29-050C087B9246}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -103,6 +105,10 @@ Global {7C622582-E281-4EAB-AADA-B5893BB89B45}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C622582-E281-4EAB-AADA-B5893BB89B45}.Release|Any CPU.ActiveCfg = Release|Any CPU {7C622582-E281-4EAB-AADA-B5893BB89B45}.Release|Any CPU.Build.0 = Release|Any CPU + {7234B9B4-8CF5-4E68-AA29-050C087B9246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7234B9B4-8CF5-4E68-AA29-050C087B9246}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7234B9B4-8CF5-4E68-AA29-050C087B9246}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7234B9B4-8CF5-4E68-AA29-050C087B9246}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -113,5 +119,6 @@ Global {E789C72A-5CFD-436B-8EF1-61AA2852A89F} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4} {4425A246-BD18-4622-86B5-0154F19165E4} = {8E6D5255-776D-4B61-85F9-73C37AA1FB9A} {7C622582-E281-4EAB-AADA-B5893BB89B45} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4} + {7234B9B4-8CF5-4E68-AA29-050C087B9246} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4} EndGlobalSection EndGlobal diff --git a/appveyor.yml b/appveyor.yml index 413e403a1c..ddfb115642 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ init: - git config --global core.autocrlf input build_script: - - cmd: build.cmd All + - cmd: build.cmd RunIntegrationTests test: off version: 0.0.1.{build} artifacts: diff --git a/build.fsx b/build.fsx index 6b58c1801f..e67ae6bf9f 100644 --- a/build.fsx +++ b/build.fsx @@ -46,6 +46,7 @@ let solutionFilePowerShell = "Paket.PowerShell.sln" // Pattern specifying assemblies to be tested using NUnit let testAssemblies = "tests/**/bin/Release/*Tests*.dll" +let integrationTestAssemblies = "integrationtests/**/bin/Release/*Tests*.dll" // Git configuration (used for publishing documentation in gh-pages branch) // The profile where the project is posted @@ -163,6 +164,17 @@ Target "RunTests" (fun _ -> OutputFile = "TestResults.xml" }) ) + +Target "RunIntegrationTests" (fun _ -> + !! integrationTestAssemblies + |> NUnit (fun p -> + { p with + DisableShadowCopy = true + TimeOut = TimeSpan.FromMinutes 20. + OutputFile = "TestResults.xml" }) +) + + // -------------------------------------------------------------------------------------- // Build a NuGet package @@ -410,6 +422,7 @@ Target "All" DoNothing =?> ("ReleaseDocs",isLocalBuild && not isMono) "All" + ==> "RunIntegrationTests" ==> "MergePaketTool" =?> ("MergePowerShell", not isMono) ==> "SignAssemblies" @@ -431,7 +444,7 @@ Target "All" DoNothing ==> "PublishChocolatey" ==> "PublishNuGet" -"PublishNuGet" +"PublishNuGet" ==> "ReleaseGitHub" ==> "Release" diff --git a/integrationtests/Paket.IntegrationTests/AssemblyInfo.fs b/integrationtests/Paket.IntegrationTests/AssemblyInfo.fs new file mode 100644 index 0000000000..50977d5c7f --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/AssemblyInfo.fs @@ -0,0 +1,9 @@ +namespace System +open System.Reflection + +[] +[] +[] +[] +[] +do () \ No newline at end of file diff --git a/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj new file mode 100644 index 0000000000..4118b42832 --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj @@ -0,0 +1,173 @@ + + + + + Debug + AnyCPU + 2.0 + {7234b9b4-8cf5-4e68-aa29-050c087b9246} + Library + Paket.Tests + Paket.IntegrationTests + v4.5 + 4.3.0.0 + Paket.Tests + + ..\..\ + true + + + true + full + false + false + bin\Debug\ + DEBUG;TRACE + 3 + + + Project + + + + + + + pdbonly + true + true + bin\Release\ + TRACE + 3 + + + + + 11 + + + + + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets + + + + + $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets + + + + + $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets + + + + + $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\4.0\Framework\v4.0\Microsoft.FSharp.Targets + + + + + + + + + True + FsUnit.fs + + + + + + + + + ..\..\packages\build\FAKE\tools\FakeLib.dll + + + + + + + + + + + + + + ..\..\packages\FSharp.Core\lib\net20\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+sl5+netcore45\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wpa81+wp8\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\test\NUnit\lib\nunit.framework.dll + True + True + + + \ No newline at end of file diff --git a/integrationtests/Paket.IntegrationTests/ResolverFailsFastSpecs.fs b/integrationtests/Paket.IntegrationTests/ResolverFailsFastSpecs.fs new file mode 100644 index 0000000000..6821e97e89 --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/ResolverFailsFastSpecs.fs @@ -0,0 +1,16 @@ +module Paket.IntegrationTests.ResolverFailsFastSpecs + +open Fake +open System +open NUnit.Framework +open FsUnit +open System +open System.IO + +[] +let ``#166 Should resolve Nancy without timeount``() = + update "i001166-resolve-nancy-fast" + +[] +let ``#1174 Should find Ninject error``() = + updateShouldFindPackageConflict "Ninject" "i001174-resolve-fast-conflict" \ No newline at end of file diff --git a/integrationtests/Paket.IntegrationTests/TestHelper.fs b/integrationtests/Paket.IntegrationTests/TestHelper.fs new file mode 100644 index 0000000000..cd877467b9 --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/TestHelper.fs @@ -0,0 +1,29 @@ +[] +module Paket.IntegrationTests.TestHelpers + +open Fake +open System +open NUnit.Framework +open FsUnit +open System +open System.IO + +let paketToolPath = FullName(__SOURCE_DIRECTORY__ + "../../../bin/paket.exe") +let integrationTestPath = FullName(__SOURCE_DIRECTORY__ + "../../../integrationtests/scenarios") + +let update scenario = + let result = + ExecProcessAndReturnMessages (fun info -> + info.FileName <- paketToolPath + info.WorkingDirectory <- Path.Combine(integrationTestPath,scenario) + info.Arguments <- "update") (System.TimeSpan.FromMinutes 1.) + if result.ExitCode <> 0 then + let errors = String.Join(Environment.NewLine,result.Errors) + failwith errors + +let updateShouldFindPackageConflict packageName scenario = + try + update scenario + failwith "No conflict was found." + with + | exn when exn.Message.Contains(sprintf "Could not resolve package %s:" packageName) -> () \ No newline at end of file diff --git a/integrationtests/Paket.IntegrationTests/paket.references b/integrationtests/Paket.IntegrationTests/paket.references new file mode 100644 index 0000000000..700180e5d7 --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/paket.references @@ -0,0 +1,6 @@ +FSharp.Core + +group Test + NUnit + NUnit.Runners.Net4 + File:FsUnit.fs . diff --git a/integrationtests/scenarios/i001166-resolve-nancy-fast/paket.dependencies b/integrationtests/scenarios/i001166-resolve-nancy-fast/paket.dependencies new file mode 100644 index 0000000000..5653ef0c2c --- /dev/null +++ b/integrationtests/scenarios/i001166-resolve-nancy-fast/paket.dependencies @@ -0,0 +1,14 @@ +source https://nuget.org/api/v2 + +nuget FSharp.Formatting +nuget Microsoft.AspNet.SignalR.Core +nuget Microsoft.AspNet.SignalR.JS +nuget Microsoft.Owin.Hosting +nuget Microsoft.Owin.Security.Cookies +nuget Nancy 1.2.0 +nuget Nancy.MSOwinSecurity +nuget NUnit +nuget NUnit.Runners +nuget FAKE +nuget SourceLink.Fake +nuget Nancy.Serialization.JsonNet \ No newline at end of file diff --git a/integrationtests/scenarios/i001166-resolve-nancy-fast/paket.lock b/integrationtests/scenarios/i001166-resolve-nancy-fast/paket.lock new file mode 100644 index 0000000000..c797562a68 --- /dev/null +++ b/integrationtests/scenarios/i001166-resolve-nancy-fast/paket.lock @@ -0,0 +1,42 @@ +NUGET + remote: https://nuget.org/api/v2 + specs: + FAKE (4.7.2) + FSharp.Compiler.Service (1.4.0.6) + FSharp.Formatting (2.12.0) + FSharp.Compiler.Service (1.4.0.6) + FSharpVSPowerTools.Core (2.1.0) + FSharpVSPowerTools.Core (2.1.0) + FSharp.Compiler.Service (>= 1.4.0.6) + jQuery (2.1.4) + Microsoft.AspNet.SignalR.Core (2.2.0) + Microsoft.Owin (>= 2.1.0) + Microsoft.Owin.Security (>= 2.1.0) + Newtonsoft.Json (>= 6.0.4) + Owin (>= 1.0) + Microsoft.AspNet.SignalR.JS (2.2.0) + jQuery (>= 1.6.4) + Microsoft.Owin (3.0.1) + Owin (>= 1.0) + Microsoft.Owin.Hosting (3.0.1) + Microsoft.Owin (>= 3.0.1) + Owin (>= 1.0) + Microsoft.Owin.Security (3.0.1) + Microsoft.Owin (>= 3.0.1) + Owin (>= 1.0) + Microsoft.Owin.Security.Cookies (3.0.1) + Microsoft.Owin (>= 3.0.1) + Microsoft.Owin.Security (>= 3.0.1) + Owin (>= 1.0) + Nancy (1.2.0) + Nancy.MSOwinSecurity (1.0.1) + Microsoft.Owin (> 2.0) + Nancy (> 0.21) + Nancy.Serialization.JsonNet (1.2.0) + Nancy (>= 1.2.0) + Newtonsoft.Json + Newtonsoft.Json (7.0.1) + NUnit (2.6.4) + NUnit.Runners (2.6.4) + Owin (1.0.0) + SourceLink.Fake (1.1.0) diff --git a/integrationtests/scenarios/i001174-resolve-fast-conflict/paket.dependencies b/integrationtests/scenarios/i001174-resolve-fast-conflict/paket.dependencies new file mode 100644 index 0000000000..3b2d47c479 --- /dev/null +++ b/integrationtests/scenarios/i001174-resolve-fast-conflict/paket.dependencies @@ -0,0 +1,7 @@ +source https://nuget.org/api/v2 + +nuget Microsoft.AspNet.SignalR.JS +nuget Nancy.Serialization.JsonNet +nuget SourceLink.Fake +nuget Ninject.Extensions.Logging.Log4net == 3.2.0 +nuget Ninject.Extensions.Interception.Linfu == 2.2.1.2 \ No newline at end of file diff --git a/src/Paket.Core/BindingRedirects.fs b/src/Paket.Core/BindingRedirects.fs index 1c3c63e468..42851047e9 100644 --- a/src/Paket.Core/BindingRedirects.fs +++ b/src/Paket.Core/BindingRedirects.fs @@ -92,7 +92,7 @@ let private getProjectFilesInDirectory folder = Directory.GetFiles(folder, "*proj") |> Seq.filter (Path.GetExtension >> isDotNetProject) let private addConfigFileToProject projectFile = - ProjectFile.Load projectFile + ProjectFile.TryLoad projectFile |> Option.bind(fun project -> project.ProjectNode |> Xml.getNodes "ItemGroup" @@ -109,7 +109,7 @@ let private addConfigFileToProject projectFile = let private applyBindingRedirects bindingRedirects (configFilePath:string) = let projectFile = getProjectFilesInDirectory (Path.GetDirectoryName(configFilePath)) - |> Seq.map ProjectFile.Load + |> Seq.map ProjectFile.TryLoad |> Seq.tryHead |> Option.bind id diff --git a/src/Paket.Core/PackageMetaData.fs b/src/Paket.Core/PackageMetaData.fs index f13145f550..64c231dbbf 100644 --- a/src/Paket.Core/PackageMetaData.fs +++ b/src/Paket.Core/PackageMetaData.fs @@ -102,7 +102,7 @@ let loadAssemblyAttributes fileName (assembly:Assembly) = with | :? FileNotFoundException -> // retrieving via path - let assembly = Assembly.LoadFrom fileName + let assembly = Assembly.LoadFrom fileName assembly.GetCustomAttributes(true) | exn -> traceWarnfn "Loading custom attributes failed for %s.%sMessage: %s" fileName Environment.NewLine exn.Message @@ -155,7 +155,7 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa | Some packagedRef -> packagedRef :: deps, files | None -> let p = - match ProjectFile.Load(Path.Combine(projectDir, p.RelativePath) |> normalizePath) with + match ProjectFile.TryLoad(Path.Combine(projectDir, p.RelativePath) |> normalizePath) with | Some p -> p | _ -> failwithf "Missing project reference in proj file %s" p.RelativePath diff --git a/src/Paket.Core/ProjectFile.fs b/src/Paket.Core/ProjectFile.fs index 759107e7a6..ee28c2fd13 100644 --- a/src/Paket.Core/ProjectFile.fs +++ b/src/Paket.Core/ProjectFile.fs @@ -148,7 +148,7 @@ type ProjectFile = FindAllFiles(folder, "*.*proj") |> Array.filter (fun f -> f.Extension = ".csproj" || f.Extension = ".fsproj" || f.Extension = ".vbproj" || f.Extension = ".wixproj") - |> Array.choose (fun fi -> ProjectFile.Load fi.FullName) + |> Array.choose (fun fi -> ProjectFile.TryLoad fi.FullName) static member FindCorrespondingFile (projectFile : FileInfo, correspondingFile:string) = let specificFile = FileInfo(Path.Combine(projectFile.Directory.FullName, projectFile.Name + "." + correspondingFile)) @@ -958,17 +958,20 @@ type ProjectFile = OriginalText = Utils.normalizeXml doc Language = LanguageEvaluation.getProjectLanguage doc (Path.GetFileName(fullName)) } - static member Load(fileName:string) = + static member LoadFromFile(fileName:string) = + let fileInfo = FileInfo (normalizePath fileName) + use stream = fileInfo.OpenRead() + ProjectFile.LoadFromStream(fileInfo.FullName, stream) + + static member TryLoad(fileName:string) = try - let fileInfo = FileInfo (normalizePath fileName) - use stream = fileInfo.OpenRead() - let project = ProjectFile.LoadFromStream(fileInfo.FullName, stream) - Some project + Some(ProjectFile.LoadFromFile(fileName)) with | exn -> traceWarnfn "Unable to parse %s:%s %s" fileName Environment.NewLine exn.Message None + static member TryFindProject(projects: ProjectFile seq,projectName) = match projects |> Seq.tryFind (fun p -> p.NameWithoutExtension = projectName || p.Name = projectName) with | Some p -> Some p @@ -979,7 +982,7 @@ type ProjectFile = match projects |> Seq.tryFind (fun p -> (FileInfo p.FileName).Directory.ToString().ToLower() = dir.ToString().ToLower()) with | Some p -> Some p | None -> - if dir.Parent = null then None else + if isNull dir.Parent then None else checkDir dir.Parent checkDir fi.Directory diff --git a/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs b/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs index d2fe9bf2d6..477abe9725 100644 --- a/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs +++ b/tests/Paket.Tests/InstallModel/Xml/CodeCracker.fs @@ -31,7 +31,7 @@ let ``should generate Xml for codecracker.CSharp``() = ], Nuspec.All) - let project = ProjectFile.Load("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") Assert.IsTrue(project.IsSome) let _,_,_,analyzerNodes = project.Value.GenerateXml(model,true,true,None) analyzerNodes @@ -51,7 +51,7 @@ let ``should generate Xml for codecracker.CSharp in VisualBasic project``() = ], Nuspec.All) - let project = ProjectFile.Load("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") Assert.IsTrue(project.IsSome) let _,_,_,analyzerNodes = project.Value.GenerateXml(model,true,true,None) analyzerNodes @@ -81,7 +81,7 @@ let ``should generate Xml for codecracker.VisualBasic``() = ], Nuspec.All) - let project = ProjectFile.Load("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") Assert.IsTrue(project.IsSome) let _,_,_,analyzerNodes = project.Value.GenerateXml(model,true,true,None) analyzerNodes diff --git a/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs b/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs index d97c44bef5..19c68e1bd9 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FSharp.Data.SqlClient.fs @@ -39,7 +39,7 @@ let ``should generate Xml for FSharp.Data.SqlClient 1.4.4``() = [], Nuspec.Load("Nuspec/FSharp.Data.SqlClient.nuspec")) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs b/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs index ef87b914ba..dfa1ee3ace 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Fantomas.fs @@ -27,7 +27,7 @@ let ``should generate Xml for Fantomas 1.5``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - let propertyNodes,chooseNode,additionalNode, _ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let propertyNodes,chooseNode,additionalNode, _ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) @@ -63,7 +63,7 @@ let ``should generate full Xml for Fantomas 1.5``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - let project = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value + let project = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value let completeModel = [(Constants.MainDependencyGroup, (PackageName "Fantomas")),(model,model)] |> Map.ofSeq let used = [(Constants.MainDependencyGroup, (PackageName "fantoMas")), (InstallSettings.Default,InstallSettings.Default)] |> Map.ofSeq project.UpdateReferences(completeModel,used,false) @@ -84,7 +84,7 @@ let ``should not generate full Xml for Fantomas 1.5 if not referenced``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - let project = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value + let project = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value let completeModel = [(Constants.MainDependencyGroup, (PackageName "Fantomas")),(model,model)] |> Map.ofSeq let used = [(Constants.MainDependencyGroup, (PackageName "blub")), (InstallSettings.Default,InstallSettings.Default) ] |> Map.ofSeq project.UpdateReferences(completeModel,used,false) @@ -120,7 +120,7 @@ let ``should generate full Xml with reference condition for Fantomas 1.5``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - let project = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value + let project = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value let completeModel = [(Constants.MainDependencyGroup, (PackageName "Fantomas")),(model,model)] |> Map.ofSeq let settings = { InstallSettings.Default @@ -161,7 +161,7 @@ let ``should generate full Xml with reference condition and framework restrictio [], Nuspec.All) - let project = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value + let project = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value let completeModel = [(Constants.MainDependencyGroup, (PackageName "Fantomas")),(model,model)] |> Map.ofSeq let settings = { InstallSettings.Default diff --git a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs index 3f4db8ffb3..e9ec6d4393 100644 --- a/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs +++ b/tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs @@ -27,7 +27,7 @@ let ``should generate Xml for Fantomas 1.5``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,false,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,false,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs b/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs index d9317a763f..2ffdfdc267 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Fuchu.fs @@ -27,7 +27,7 @@ let ``should generate Xml for Fuchu 0.4``() = [], Nuspec.All) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs index 88ddeca55e..e029ab4dd2 100644 --- a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs +++ b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs @@ -25,7 +25,7 @@ let ``should generate Xml for GitInfoPlanter2.0.0``() = [], Nuspec.All) - let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml emptyReferences) diff --git a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs index a5592b0f0f..d41792a463 100644 --- a/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/LibGit2Sharp.fs @@ -43,7 +43,7 @@ let ``should generate Xml for LibGit2Sharp 2.0.0``() = model.GetLibReferences(SinglePlatform (DotNetFramework FrameworkVersion.V4_Client)) |> shouldContain @"..\LibGit2Sharp\lib\net40\LibGit2Sharp.dll" - let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expectedReferenceNodes) diff --git a/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs b/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs index 69e605c571..6bd6296702 100644 --- a/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs +++ b/tests/Paket.Tests/InstallModel/Xml/ManualNodes.fs @@ -17,7 +17,7 @@ let ``should find custom nodes in doc``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - ProjectFile.Load("./ProjectFile/TestData/CustomFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty + ProjectFile.TryLoad("./ProjectFile/TestData/CustomFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty |> shouldEqual false [] @@ -31,7 +31,7 @@ let ``should find custom Paket nodes in doc``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - ProjectFile.Load("./ProjectFile/TestData/CustomPaketFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty + ProjectFile.TryLoad("./ProjectFile/TestData/CustomPaketFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty |> shouldEqual false @@ -46,7 +46,7 @@ let ``should not find custom nodes if there are none``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - ProjectFile.Load("./ProjectFile/TestData/NoCustomFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty + ProjectFile.TryLoad("./ProjectFile/TestData/NoCustomFantomasNode.fsprojtest").Value.GetCustomModelNodes(model).IsEmpty |> shouldEqual true @@ -61,7 +61,7 @@ let ``should delete custom nodes if there are some``() = [], Nuspec.Explicit ["FantomasLib.dll"]) - let project = ProjectFile.Load("./ProjectFile/TestData/CustomFantomasNode.fsprojtest").Value + let project = ProjectFile.TryLoad("./ProjectFile/TestData/CustomFantomasNode.fsprojtest").Value project.GetCustomModelNodes(model).Length |> shouldEqual 2 diff --git a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs index 4e25e20bfb..efb818702a 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Microsoft.Bcl.Build.fs @@ -16,6 +16,6 @@ let ``should not install targets node for Microsoft.Bcl.Build``() = model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V4)) |> shouldContain @"..\Microsoft.Bcl.Build\build\Microsoft.Bcl.Build.targets" - let propertyNodes,_,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,false,None) + let propertyNodes,_,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,false,None) propertyNodes |> Seq.length |> shouldEqual 0 \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs b/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs index 6648c33bd6..79d2484cbf 100644 --- a/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs +++ b/tests/Paket.Tests/InstallModel/Xml/Microsoft.CodeAnalysis.Analyzers.fs @@ -33,7 +33,7 @@ let expectedCs = """ [] let ``should generate Xml for Microsoft.CodeAnalysis.Analyzers in CSharp project``() = - let project = ProjectFile.Load("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") Assert.IsTrue(project.IsSome) let _,_,_,analyzerNodes = project.Value.GenerateXml(model,true,true,None) analyzerNodes @@ -53,7 +53,7 @@ let expectedVb = """ [] let ``should generate Xml for RefactoringEssentials in VisualBasic project``() = - let project = ProjectFile.Load("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") Assert.IsTrue(project.IsSome) let _,_,_,analyzerNodes = project.Value.GenerateXml(model,true,true,None) analyzerNodes @@ -72,7 +72,7 @@ let expectedEmpty = """ normalizeXml |> shouldEqual (normalizeXml expected) \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs b/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs index 464aa15419..3edecc5c0c 100644 --- a/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs +++ b/tests/Paket.Tests/InstallModel/Xml/RefactoringEssentials.fs @@ -24,7 +24,7 @@ let ``should generate Xml for RefactoringEssentials in CSharp project``() = ], Nuspec.All) - let project = ProjectFile.Load("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyCsharpGuid.csprojtest") Assert.IsTrue(project.IsSome) let _,_,_,analyzerNodes = project.Value.GenerateXml(model,true,true,None) analyzerNodes @@ -43,7 +43,7 @@ let ``should generate Xml for RefactoringEssentials in VisualBasic project``() = ], Nuspec.All) - let project = ProjectFile.Load("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") + let project = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyVbGuid.vbprojtest") Assert.IsTrue(project.IsSome) let _,_,_,analyzerNodes = project.Value.GenerateXml(model,true,true,None) analyzerNodes diff --git a/tests/Paket.Tests/InstallModel/Xml/RemovesOldNodes.fs b/tests/Paket.Tests/InstallModel/Xml/RemovesOldNodes.fs index 3898927b89..8f107c0a56 100644 --- a/tests/Paket.Tests/InstallModel/Xml/RemovesOldNodes.fs +++ b/tests/Paket.Tests/InstallModel/Xml/RemovesOldNodes.fs @@ -9,7 +9,7 @@ open Paket.Requirements [] let ``should generate Xml for Fuchu 0.4``() = - let p = ProjectFile.Load("./ProjectFile/TestData/EmptyWithOldStuff.fsprojtest").Value - let empty = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value + let p = ProjectFile.TryLoad("./ProjectFile/TestData/EmptyWithOldStuff.fsprojtest").Value + let empty = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value p.RemovePaketNodes() p.Document.OuterXml |> shouldEqual empty.Document.OuterXml diff --git a/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs b/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs index 581e6cd9a0..f0a5cbe1cc 100644 --- a/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs +++ b/tests/Paket.Tests/InstallModel/Xml/RxXaml.fs @@ -110,7 +110,7 @@ let ``should generate Xml for Rx-XAML 2.2.4 with correct framework assembly refe { AssemblyName = "System.Windows"; FrameworkRestrictions = [FrameworkRestriction.Exactly(Silverlight "v5.0")] } { AssemblyName = "System.Windows"; FrameworkRestrictions = [FrameworkRestriction.Exactly(WindowsPhoneSilverlight "v7.1")] }]}) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs index 06e608a5d8..4e7af7f86e 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SQLite.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SQLite.fs @@ -90,7 +90,7 @@ let ``should generate Xml for SQLite``() = [], Nuspec.All) - let propertyNodes,chooseNode,propertyDefinitionNodes,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let propertyNodes,chooseNode,propertyDefinitionNodes,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expectedReferenceNodes) diff --git a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs index aa3739d87a..f0b452b2c1 100644 --- a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs +++ b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs @@ -23,7 +23,7 @@ let ``should generate Xml for StyleCop.MSBuild``() = model.GetTargetsFiles(SinglePlatform (DotNetFramework FrameworkVersion.V2)) |> shouldContain @"..\StyleCop.MSBuild\build\StyleCop.MSBuild.Targets" - let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) propertyChooseNode.OuterXml |> normalizeXml diff --git a/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs b/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs index 21d2abdcf1..afbffef789 100644 --- a/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs +++ b/tests/Paket.Tests/InstallModel/Xml/System.Spatial.fs @@ -44,7 +44,7 @@ let ``should generate Xml for System.Spatial``() = @"..\System.Spatial\lib\sl4\zh-Hans\System.Spatial.resources.dll" ],[],[],Nuspec.All) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) \ No newline at end of file diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs index 46fe134f10..642470cac1 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttp.fs @@ -191,7 +191,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [], Nuspec.All) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs index 80c9a2fc78..efdd0ea658 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpForNet4.fs @@ -69,7 +69,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [], Nuspec.All) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs index 1a1b17e731..ca376639f4 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithExistingFrameworkReferences.fs @@ -69,7 +69,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [{ AssemblyName = "System.Net.Http"; FrameworkRestrictions = [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5))] } { AssemblyName = "System.Net.Http.WebRequest"; FrameworkRestrictions = [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5))] }]}) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/FrameworkAssemblies.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/FrameworkAssemblies.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs index b3e36daf26..9a3b08e8ba 100644 --- a/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs +++ b/tests/Paket.Tests/InstallModel/Xml/SystemNetHttpWithFrameworkReferences.fs @@ -77,7 +77,7 @@ let ``should generate Xml for System.Net.Http 2.2.8``() = [{ AssemblyName = "System.Net.Http"; FrameworkRestrictions = [FrameworkRestriction.AtLeast(DotNetFramework(FrameworkVersion.V4_5))] } { AssemblyName = "System.Net.Http.WebRequest"; FrameworkRestrictions = [FrameworkRestriction.Exactly(DotNetFramework(FrameworkVersion.V4_5))] }]}) - let _,chooseNode,_,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let _,chooseNode,_,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml expected) diff --git a/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs b/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs index 6feb958e1d..31d33790b6 100644 --- a/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs +++ b/tests/Paket.Tests/InstallModel/Xml/xunit.runner.fs @@ -36,7 +36,7 @@ let ``should generate Xml for xunit.runner.visualstudio 2.0.0``() = [], Nuspec.All) - let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) + let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,true,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml emptyReferenceNodes) @@ -63,7 +63,7 @@ let ``should not generate Xml for xunit.runner.visualstudio 2.0.0 if import is d [], Nuspec.All) - let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,false,None) + let propertyNodes,chooseNode,propertyChooseNode,_ = ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model,true,false,None) chooseNode.OuterXml |> normalizeXml |> shouldEqual (normalizeXml emptyReferenceNodes) diff --git a/tests/Paket.Tests/PackageProcessSpecs.fs b/tests/Paket.Tests/PackageProcessSpecs.fs index fd47ff0bc3..ffb1eaf84a 100644 --- a/tests/Paket.Tests/PackageProcessSpecs.fs +++ b/tests/Paket.Tests/PackageProcessSpecs.fs @@ -32,16 +32,23 @@ let ``Loading id from assembly works``() = let ``Loading assembly metadata works``() = let workingDir = Path.GetFullPath(".") + let fileName = + Path.Combine(workingDir, "..", "..", "Paket.Tests.fsproj") + |> normalizePath + + if File.Exists fileName |> not then + failwithf "%s does not exist." fileName + let projFile = Path.Combine(workingDir, "..", "..", "Paket.Tests.fsproj") |> normalizePath - |> ProjectFile.Load + |> ProjectFile.LoadFromFile let config = if workingDir.Contains "Debug" then "Debug" else "Release" - - let assembly,id,fileName = PackageMetaData.loadAssemblyId config projFile.Value + + let assembly,id,fileName = PackageMetaData.loadAssemblyId config projFile id |> shouldEqual "Paket.Tests" let attribs = PackageMetaData.loadAssemblyAttributes fileName assembly diff --git a/tests/Paket.Tests/Paket.Tests.fsproj b/tests/Paket.Tests/Paket.Tests.fsproj index 0ed512d104..093d6e2067 100644 --- a/tests/Paket.Tests/Paket.Tests.fsproj +++ b/tests/Paket.Tests/Paket.Tests.fsproj @@ -24,7 +24,7 @@ bin\Debug\ DEBUG;TRACE 3 - bin\Debug\fsharp_project_scaffold_tests.XML + bin\Debug\Paket.Tests.XML Project diff --git a/tests/Paket.Tests/ProjectFile/FrameworkReferencesSpecs.fs b/tests/Paket.Tests/ProjectFile/FrameworkReferencesSpecs.fs index 21d9ab1e88..b6e8ab5945 100644 --- a/tests/Paket.Tests/ProjectFile/FrameworkReferencesSpecs.fs +++ b/tests/Paket.Tests/ProjectFile/FrameworkReferencesSpecs.fs @@ -6,10 +6,10 @@ open FsUnit [] let ``should detect empty framework references in empty project``() = - ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GetFrameworkAssemblies() + ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GetFrameworkAssemblies() |> shouldEqual [] [] let ``should detect references in project1``() = - ProjectFile.Load("./ProjectFile/TestData/Project1.fsprojtest").Value.GetFrameworkAssemblies() + ProjectFile.TryLoad("./ProjectFile/TestData/Project1.fsprojtest").Value.GetFrameworkAssemblies() |> shouldEqual ["mscorlib"; "System"] \ No newline at end of file diff --git a/tests/Paket.Tests/ProjectFile/InterProjectDependencySpecs.fs b/tests/Paket.Tests/ProjectFile/InterProjectDependencySpecs.fs index b0f1ac8ea1..f37820e41b 100644 --- a/tests/Paket.Tests/ProjectFile/InterProjectDependencySpecs.fs +++ b/tests/Paket.Tests/ProjectFile/InterProjectDependencySpecs.fs @@ -7,25 +7,25 @@ open System [] let ``should detect no dependencies in empty proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GetInterProjectDependencies() + ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GetInterProjectDependencies() |> shouldBeEmpty [] let ``should detect Paket dependency in Project1 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project1.fsprojtest").Value.GetInterProjectDependencies() + ProjectFile.TryLoad("./ProjectFile/TestData/Project1.fsprojtest").Value.GetInterProjectDependencies() |> List.map (fun p -> p.Name) |> shouldEqual ["Paket"] [] let ``should detect Paket and Paket.Core dependency in Project2 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies() + ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies() |> List.map (fun p -> p.Name) |> shouldEqual ["Paket"; "Paket.Core"] [] let ``should detect path for dependencies in Project2 proj file``() = let paths = - ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies() + ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies() |> List.map (fun p -> p.Path) paths.[0].EndsWith(normalizePath "src/Paket/Paket.fsproj") |> shouldEqual true @@ -34,7 +34,7 @@ let ``should detect path for dependencies in Project2 proj file``() = [] let ``should detect relative path for dependencies in Project2 proj file``() = let paths = - ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies() + ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value.GetInterProjectDependencies() |> List.map (fun p -> p.RelativePath) paths.[0] |> shouldEqual "..\\..\\src\\Paket\\Paket.fsproj" @@ -42,7 +42,7 @@ let ``should detect relative path for dependencies in Project2 proj file``() = [] let ``should detect Guids for dependencies in Project2 proj file``() = - let p = ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value + let p = ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value p.GetProjectGuid() |> shouldEqual (Guid.Parse "e789c72a-5cfd-436b-8ef1-61aa2852a89f") p.GetInterProjectDependencies() |> List.map (fun p -> p.GUID.ToString()) diff --git a/tests/Paket.Tests/ProjectFile/OutputSpecs.fs b/tests/Paket.Tests/ProjectFile/OutputSpecs.fs index 775bc00d0c..fc8e45b17f 100644 --- a/tests/Paket.Tests/ProjectFile/OutputSpecs.fs +++ b/tests/Paket.Tests/ProjectFile/OutputSpecs.fs @@ -8,55 +8,55 @@ open System.Xml.Linq [] let ``should detect lib output type for Project1 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project1.fsprojtest").Value.OutputType + ProjectFile.TryLoad("./ProjectFile/TestData/Project1.fsprojtest").Value.OutputType |> shouldEqual ProjectOutputType.Library [] let ``should detect exe output type for Project2 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.OutputType + ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value.OutputType |> shouldEqual ProjectOutputType.Exe [] let ``should detect exe output type for Project3 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project3.fsprojtest").Value.OutputType + ProjectFile.TryLoad("./ProjectFile/TestData/Project3.fsprojtest").Value.OutputType |> shouldEqual ProjectOutputType.Exe [] let ``should detect target framework for Project1 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project1.fsprojtest").Value.GetTargetProfile() + ProjectFile.TryLoad("./ProjectFile/TestData/Project1.fsprojtest").Value.GetTargetProfile() |> shouldEqual (SinglePlatform(DotNetFramework(FrameworkVersion.V4_5))) [] let ``should detect target framework for Project2 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetTargetProfile() + ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value.GetTargetProfile() |> shouldEqual (SinglePlatform(DotNetFramework(FrameworkVersion.V4_Client))) [] let ``should detect output path for proj file`` ([] project) ([] configuration) = - ProjectFile.Load(sprintf "./ProjectFile/TestData/%s.fsprojtest" project).Value.GetOutputDirectory configuration + ProjectFile.TryLoad(sprintf "./ProjectFile/TestData/%s.fsprojtest" project).Value.GetOutputDirectory configuration |> shouldEqual (System.IO.Path.Combine(@"bin", configuration) |> normalizePath) [] let ``should detect assembly name for Project1 proj file`` () = - ProjectFile.Load("./ProjectFile/TestData/Project1.fsprojtest").Value.GetAssemblyName() + ProjectFile.TryLoad("./ProjectFile/TestData/Project1.fsprojtest").Value.GetAssemblyName() |> shouldEqual ("Paket.Tests.dll") [] let ``should detect assembly name for Project2 proj file`` () = - ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetAssemblyName() + ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value.GetAssemblyName() |> shouldEqual ("Paket.Tests.exe") [] let ``should detect assembly name for Project3 proj file`` () = - ProjectFile.Load("./ProjectFile/TestData/Project3.fsprojtest").Value.GetAssemblyName() + ProjectFile.TryLoad("./ProjectFile/TestData/Project3.fsprojtest").Value.GetAssemblyName() |> shouldEqual ("Paket.Tests.Win.exe") [] let ``should maintain order when updating project file items`` () = - let projFile = ProjectFile.Load("./ProjectFile/TestData/MaintainsOrdering.fsprojtest").Value + let projFile = ProjectFile.TryLoad("./ProjectFile/TestData/MaintainsOrdering.fsprojtest").Value let fileItems = [ { BuildAction = "Compile"; Include = "..\\..\\paket-files\\fsharp\\FSharp.Data\\src\\CommonRuntime\\Pluralizer.fs"; Link = Some("fsharp_data\\Pluralizer.fs") } { BuildAction = "Compile"; Include = "..\\..\\paket-files\\fsharp\\FSharp.Data\\src\\CommonRuntime\\NameUtils.fs"; Link = Some("fsharp_data\\NameUtils.fs") } @@ -104,7 +104,7 @@ let ``should maintain order when updating project file items`` () = [] let ``should remove missing files that exist in the project`` () = - let projFile = ProjectFile.Load("./ProjectFile/TestData/MaintainsOrdering.fsprojtest").Value + let projFile = ProjectFile.TryLoad("./ProjectFile/TestData/MaintainsOrdering.fsprojtest").Value let fileItems = [ { BuildAction = "Compile"; Include = "DebugProvidedTypes.fs"; Link = None } { BuildAction = "Compile"; Include = "ProvidedTypes.fs"; Link = None } diff --git a/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs b/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs index 490f882ff0..c3f59c9be6 100644 --- a/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs +++ b/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs @@ -6,20 +6,20 @@ open FsUnit [] let ``should detect TargetFramework in Project2 proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Project2.fsprojtest").Value.GetTargetProfile().ToString() + ProjectFile.TryLoad("./ProjectFile/TestData/Project2.fsprojtest").Value.GetTargetProfile().ToString() |> shouldEqual "net40" [] let ``should detect net40 in empty proj file``() = - ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GetTargetProfile().ToString() + ProjectFile.TryLoad("./ProjectFile/TestData/Empty.fsprojtest").Value.GetTargetProfile().ToString() |> shouldEqual "net40" [] let ``should detect silverlight framework in new silverlight project2``() = - ProjectFile.Load("./ProjectFile/TestData/NewSilverlightClassLibrary.csprojtest").Value.GetTargetProfile() + ProjectFile.TryLoad("./ProjectFile/TestData/NewSilverlightClassLibrary.csprojtest").Value.GetTargetProfile() |> shouldEqual (SinglePlatform(Silverlight("v5.0"))) [] let ``should detect portable profile``() = - ProjectFile.Load("./ProjectFile/TestData/FSharp.Core.Fluent-3.1.fsprojtest").Value.GetTargetProfile() + ProjectFile.TryLoad("./ProjectFile/TestData/FSharp.Core.Fluent-3.1.fsprojtest").Value.GetTargetProfile() |> shouldEqual (PortableProfile("Profile259", [ DotNetFramework FrameworkVersion.V4_5; Windows "v4.5"; WindowsPhoneSilverlight "v8.0"; WindowsPhoneApp "v8.1" ]))