Skip to content

Commit

Permalink
test for to make sure we can parse first entry from nuget.org package…
Browse files Browse the repository at this point in the history
… feed
  • Loading branch information
Tom Rathbone committed Apr 29, 2015
1 parent 63a6aa3 commit 713801a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ nuget xunit.extensions
nuget Newtonsoft.Json
nuget Microsoft.AspNet.Razor 2.0.30506
nuget Microsoft.AspNet.WebPages 2.0.30506
nuget Unquote

github matthid/Yaaf.FSharp.Scripting src/source/Yaaf.FSharp.Scripting/YaafFSharpScripting.fs
1 change: 1 addition & 0 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ NUGET
toastr (2.1.1)
jQuery (>= 1.6.3)
UnionArgParser (0.8.6)
Unquote (2.2.2)
xunit (1.9.2)
xunit.extensions (1.9.2)
xunit (1.9.2)
Expand Down
22 changes: 22 additions & 0 deletions src/test/FsCheck.Fake/FsCheck.Fake.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<ItemGroup>
<Compile Include="TestStringHelper.fs" />
<Compile Include="TestParallelBuildOrder.fs" />
<Compile Include="TestNuget.fs" />
<None Include="app.config" />
<None Include="paket.references" />
</ItemGroup>
Expand All @@ -72,6 +73,7 @@
<Project>{13d56521-772a-41db-9772-1da1a4aa8e3a}</Project>
<Private>True</Private>
</ProjectReference>
<Reference Include="System.Xml" />
</ItemGroup>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
Expand Down Expand Up @@ -160,6 +162,26 @@
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == 'Silverlight' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v5.0')">
<ItemGroup>
<Reference Include="Unquote">
<HintPath>..\..\..\packages\Unquote\lib\sl4\Unquote.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
<ItemGroup>
<Reference Include="Unquote">
<HintPath>..\..\..\packages\Unquote\lib\net40\Unquote.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5' Or $(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
<ItemGroup>
Expand Down
35 changes: 35 additions & 0 deletions src/test/FsCheck.Fake/TestNuget.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module FsCheck.Fake.TestNuget

open System
open global.Xunit
open Fake
open Swensen.Unquote

// taken from http://www.nuget.org/api/v2/Packages()?$filter=(Id%20eq%20%27FAKE%27)%20and%20IsLatestVersion
let xmlForFirstEntryFromNugetOrgPackageList = """<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://www.nuget.org/api/v2/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><id>http://www.nuget.org/api/v2/Packages</id><title type="text">Packages</title><updated>2015-04-29T16:34:33Z</updated><link rel="self" title="Packages" href="Packages" /><entry><id>http://www.nuget.org/api/v2/Packages(Id='FAKE',Version='3.30.0')</id><category term="NuGetGallery.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="V2FeedPackage" href="Packages(Id='FAKE',Version='3.30.0')" /><title type="text">FAKE</title><summary type="text">FAKE - F# Make - Get rid of the noise in your build scripts.</summary><updated>2015-04-29T16:29:58Z</updated><author><name>Steffen Forkmann, Mauricio Scheffer, Colin Bull</name></author><link rel="edit-media" title="V2FeedPackage" href="Packages(Id='FAKE',Version='3.30.0')/$value" /><content type="application/zip" src="http://www.nuget.org/api/v2/package/FAKE/3.30.0" /><m:properties><d:Version>3.30.0</d:Version><d:NormalizedVersion>3.30.0</d:NormalizedVersion><d:Copyright m:null="true" /><d:Created m:type="Edm.DateTime">2015-04-29T07:55:25.17</d:Created><d:Dependencies></d:Dependencies><d:Description>FAKE - F# Make - is a build automation tool for .NET. Tasks and dependencies are specified in a DSL which is integrated in F#. This package bundles all extensions.</d:Description><d:DownloadCount m:type="Edm.Int32">162456</d:DownloadCount><d:GalleryDetailsUrl>http://www.nuget.org/packages/FAKE/3.30.0</d:GalleryDetailsUrl><d:IconUrl>https://raw.githubusercontent.com/fsharp/FAKE/master/help/pics/logo.png</d:IconUrl><d:IsLatestVersion m:type="Edm.Boolean">true</d:IsLatestVersion><d:IsAbsoluteLatestVersion m:type="Edm.Boolean">true</d:IsAbsoluteLatestVersion><d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease><d:Language>en-US</d:Language><d:Published m:type="Edm.DateTime">2015-04-29T07:55:25.17</d:Published><d:PackageHash>tVt0qOybftvi01x3envu9tPO9wErXVHv+zKMay+7h2RRJHIAkA/GgP3XzWlf1tgUQEnd0F/pW+izcSaiOQkG8Q==</d:PackageHash><d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm><d:PackageSize m:type="Edm.Int64">13414832</d:PackageSize><d:ProjectUrl>http://www.github.com/fsharp/Fake</d:ProjectUrl><d:ReportAbuseUrl>http://www.nuget.org/package/ReportAbuse/FAKE/3.30.0</d:ReportAbuseUrl><d:ReleaseNotes>FCS simplification - https://github.com/fsharp/FAKE/pull/773
Paket push task runs in parallel - https://github.com/fsharp/FAKE/pull/768</d:ReleaseNotes><d:RequireLicenseAcceptance m:type="Edm.Boolean">false</d:RequireLicenseAcceptance><d:Tags>build fake f#</d:Tags><d:Title m:null="true" /><d:VersionDownloadCount m:type="Edm.Int32">136</d:VersionDownloadCount><d:MinClientVersion m:null="true" /><d:LastEdited m:type="Edm.DateTime" m:null="true" /><d:LicenseUrl>http://www.github.com/fsharp/Fake/blob/master/License.txt</d:LicenseUrl><d:LicenseNames m:null="true" /><d:LicenseReportUrl m:null="true" /></m:properties></entry></feed>"""

[<Fact>]
let ``Can parse package information from nuget.org stream`` () =
let xml = XMLDoc xmlForFirstEntryFromNugetOrgPackageList
let firstEntry = xml.DocumentElement.GetElementsByTagName("entry").Item(0)
let result = extractFeedPackageFromXml firstEntry
let expected = {
Id = "FAKE"
Version = "3.30.0"
Authors = "Steffen Forkmann, Mauricio Scheffer, Colin Bull"
Owners = "Steffen Forkmann, Mauricio Scheffer, Colin Bull"
Url = "http://www.nuget.org/api/v2/package/FAKE/3.30.0"
IsLatestVersion = true
Created = DateTime.Parse("2015-04-29T07:55:25.17")
Published = DateTime.Parse("2015-04-29T07:55:25.17")
PackageHash = "tVt0qOybftvi01x3envu9tPO9wErXVHv+zKMay+7h2RRJHIAkA/GgP3XzWlf1tgUQEnd0F/pW+izcSaiOQkG8Q=="
PackageHashAlgorithm = "SHA512"
LicenseUrl = "http://www.github.com/fsharp/Fake/blob/master/License.txt"
ProjectUrl = "http://www.github.com/fsharp/Fake"
RequireLicenseAcceptance = false
Description = "FAKE - F# Make - is a build automation tool for .NET. Tasks and dependencies are specified in a DSL which is integrated in F#. This package bundles all extensions."
Language = "en-US"
Tags = "build fake f#" }
test <@ expected = result @>
()
3 changes: 2 additions & 1 deletion src/test/FsCheck.Fake/paket.references
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FSharp.Core
FsCheck.Xunit
FsCheck.Xunit
Unquote

0 comments on commit 713801a

Please sign in to comment.