diff --git a/.gitignore b/.gitignore index 119fbe9..03eedc8 100644 --- a/.gitignore +++ b/.gitignore @@ -229,11 +229,9 @@ FakesAssemblies/ **/*.Server/ModelManifest.xml _Pvt_Extensions -# Paket dependency manager -.paket/paket.exe - # FAKE - F# Make .fake/ paket-files/ packages/ .Argolis_coverage.xml +coverage/ \ No newline at end of file diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets index 98c71f9..0df24f9 100644 --- a/.paket/Paket.Restore.targets +++ b/.paket/Paket.Restore.targets @@ -11,15 +11,49 @@ $(MSBuildThisFileDirectory)..\ $(PaketRootPath)paket-files\paket.restore.cached $(PaketRootPath)paket.lock + classic + proj + assembly + native /Library/Frameworks/Mono.framework/Commands/mono mono - - $(PaketRootPath)paket.exe - $(PaketToolsPath)paket.exe - "$(PaketExePath)" - $(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" + + $(PaketRootPath)paket.bootstrapper.exe $(PaketToolsPath)paket.bootstrapper.exe + $([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\ + + + + + $(PaketRootPath)paket.exe + $(PaketToolsPath)paket.exe + $(PaketToolsPath)paket.exe + $(_PaketBootStrapperExeDir)paket.exe + paket.exe + + + $(PaketRootPath)paket + $(PaketToolsPath)paket + $(PaketToolsPath)paket + + + $(PaketRootPath)paket.exe + $(PaketToolsPath)paket.exe + + + $(PaketBootStrapperExeDir)paket.exe + + + paket + + + <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) + dotnet "$(PaketExePath)" + $(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" + "$(PaketExePath)" + + "$(PaketBootStrapperExePath)" $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)" @@ -28,30 +62,42 @@ true true + + + True + + $(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/')) - + + + + + true - $(NoWarn);NU1603 + $(NoWarn);NU1603;NU1604;NU1605;NU1608 - /usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }' - /usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }' + /usr/bin/shasum "$(PaketRestoreCacheFile)" | /usr/bin/awk '{ print $1 }' + /usr/bin/shasum "$(PaketLockFilePath)" | /usr/bin/awk '{ print $1 }' - - + + - - + + + + + $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) @@ -61,20 +107,37 @@ true - - - + + + true + + + + + + + + + + + + - $(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).paket.references.cached + $(PaketIntermediateOutputPath)\$(MSBuildProjectFile).paket.references.cached $(MSBuildProjectFullPath).paket.references $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references $(MSBuildProjectDirectory)\paket.references - $(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).$(TargetFramework).paket.resolved + + false + true true references-file-or-cache-not-found @@ -93,35 +156,48 @@ - + true - target-framework '$(TargetFramework)' + target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths) - + + - + + false + true + + - + - + + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length) $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0]) $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4]) + $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5]) %(PaketReferencesFileLinesInfo.PackageVersion) + All + runtime + runtime + true + true - $(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).paket.clitools + $(PaketIntermediateOutputPath)/$(MSBuildProjectFile).paket.clitools @@ -138,30 +214,41 @@ + - + false + $(MSBuildVersion) + 15.8.0 - + - <_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/> + <_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/> + + $(MSBuildProjectDirectory)/$(MSBuildProjectFile) true - false - true - $(BaseIntermediateOutputPath)$(Configuration) - $(BaseIntermediateOutputPath) + false + true + false + true + false + true + false + true + $(PaketIntermediateOutputPath)\$(Configuration) + $(PaketIntermediateOutputPath) @@ -172,11 +259,101 @@ - - + - + + + + - + + + + + \ No newline at end of file diff --git a/after.Argolis.sln.targets b/after.Argolis.sln.targets deleted file mode 100644 index 51580dd..0000000 --- a/after.Argolis.sln.targets +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/appveyor.yml b/appveyor.yml index c5ef847..ddba930 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,30 +1,8 @@ -image: Visual Studio 2017 - -install: - - choco install gitversion.portable -pre -y - -before_build: - - .paket\paket.bootstrapper.exe prerelease - - .paket\paket.exe restore - - ps: gitversion /l console /output buildserver - -build: - project: Argolis.sln - -configuration: Release - -after_build: - - .paket\paket.exe pack output nugets include-referenced-projects version %GitVersion_NuGetVersion% - -after_test: - - .\packages\OpenCover\tools\OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:"src\Argolis.Tests\bin\Release\Argolis.Tests.dll src\Argolis.Tests.Integration\bin\Release\Argolis.Tests.Integration.dll -noshadow -appveyor" -returntargetcode -filter:"+[Argolis*]* -[Argolis.Tests*]* -[Test*]*" -hideskipped:All -output:.\Argolis_coverage.xml - - "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%" - - pip install codecov - - codecov -f "Argolis_coverage.xml" +build_script: + - ps: .\build.ps1 -Target CI -verbosity Verbose -configuration Release artifacts: - path: 'nugets\*.nupkg' - - path: Argolis_coverage.xml cache: - packages -> paket.lock diff --git a/build.cake b/build.cake new file mode 100644 index 0000000..2c20d45 --- /dev/null +++ b/build.cake @@ -0,0 +1,115 @@ +#tool paket:?package=OpenCover +#tool paket:?package=codecov +#tool paket:?package=GitVersion.CommandLine +#addin paket:?package=Cake.Paket +#addin paket:?package=Cake.Codecov + +var target = Argument("target", "Build"); +var configuration = Argument("Configuration", "Debug"); + +GitVersion version; + +Task("CI") + .IsDependentOn("Pack") + .IsDependentOn("Codecov").Does(() => {}); + +Task("Pack") + .IsDependentOn("Build") + .DoesForEach(GetFiles("./src/**/*.csproj"), path => { + var settings = new DotNetCorePackSettings { + Configuration = configuration, + OutputDirectory = "./nugets/", + NoBuild = true, + MSBuildSettings = new DotNetCoreMSBuildSettings() + }; + + settings.MSBuildSettings.Properties["version"] = new [] { version.NuGetVersion }; + + DotNetCorePack(path.FullPath, settings); + }); + +Task("GitVersion") + .Does(() => { + version = GitVersion(new GitVersionSettings { + UpdateAssemblyInfo = true, + }); + + if (BuildSystem.IsLocalBuild == false) + { + GitVersion(new GitVersionSettings { + OutputType = GitVersionOutput.BuildServer + }); + } + }); + +Task("Restore") + .Does(() => { + DotNetCoreRestore(new DotNetCoreRestoreSettings { + Sources = new[] { + "https://api.nuget.org/v3/index.json", + "https://www.myget.org/F/tpluscode/api/v3/index.json" + }, + }); + }); + +Task("Build") + .IsDependentOn("GitVersion") + .IsDependentOn("Restore") + .Does(() => { + DotNetCoreBuild("Argolis.sln", new DotNetCoreBuildSettings { + Configuration = configuration + }); + }); + +Task("Codecov") + .IsDependentOn("Test") + .Does(() => { + var buildVersion = string.Format("{0}.build.{1}", + version.FullSemVer, + BuildSystem.AppVeyor.Environment.Build.Number + ); + var settings = new CodecovSettings { + Files = new[] { "./coverage/cobertura.xml" }, + EnvironmentVariables = new Dictionary { { "APPVEYOR_BUILD_VERSION", buildVersion } } + }; + Codecov(settings); + }); + +Task("Test") + .IsDependentOn("Build") + .Does(RunTests("Argolis.tests")) + .Does(RunTests("Argolis.tests.Integration")) + .Does(() => { + DotCoverMerge(GetFiles("coverage\\*.dcvr"), "coverage\\merged.dcvr"); + }) + .Does(() => { + DotCoverReport( + "./coverage/merged.dcvr", + "./coverage/dotcover.xml", + new DotCoverReportSettings { + ReportType = DotCoverReportType.DetailedXML, + }); + }) + .Does(() => { + ReportGenerator("./coverage/dotcover.xml", "./coverage", new ReportGeneratorSettings() { + ReportTypes = new [] { ReportGeneratorReportType.Cobertura } + }); + }) + .DeferOnError(); + +public Action RunTests(string project) +{ + var testSettings = new DotNetCoreTestSettings + { + Configuration = configuration, + NoBuild = true + }; + + return (ICakeContext c) => + DotCoverCover( + (ICakeContext ctx) => ctx.DotNetCoreTest(GetFiles($"**\\{project}.csproj").Single().FullPath, testSettings), + $"./coverage/{project}.dcvr", + new DotCoverCoverSettings()); +} + +RunTarget(target); diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..130a15b --- /dev/null +++ b/build.ps1 @@ -0,0 +1,164 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# This version was download from https://github.com/larzw/Cake.Paket +# It was modified to use paket (instead of NuGet) for dependency management. +# Feel free to change this file to fit your needs. +########################################################################## + +<# +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. +.DESCRIPTION +This Powershell script will download paket.exe if missing, +install all your dependencies via paket.exe restore +and execute your Cake build script with the parameters you provide. +.PARAMETER Script +The build script to execute. +.PARAMETER Target +The build script target to run. +.PARAMETER Configuration +The build configuration to use. +.PARAMETER Verbosity +Specifies the amount of information to be displayed. +.PARAMETER Experimental +Tells Cake to use the latest Roslyn release. +.PARAMETER WhatIf +Performs a dry run of the build script. +No tasks will be executed. +.PARAMETER Mono +Tells Cake to use the Mono scripting engine. +.PARAMETER Paket +The relative path to the .paket directory. +.PARAMETER Cake +The relative path to directory containing Cake.exe. +.PARAMETER Tools +The relative path to the Cake tools directory. +.PARAMETER Addins +The relative path to the Cake addins directory. +.PARAMETER Modules +The relative path to the Cake modules directory. +.PARAMETER ScriptArgs +Remaining arguments are added here. +.LINK +http://cakebuild.net +#> + +[CmdletBinding()] +Param( + [string]$Script = "build.cake", + [string]$Target = "Default", + [ValidateSet("Release", "Debug")] + [string]$Configuration = "Release", + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity = "Verbose", + [switch]$Experimental, + [Alias("DryRun","Noop")] + [switch]$WhatIf, + [switch]$Mono, + [ValidatePattern('.paket$')] + [string]$Paket = ".\.paket", + [string]$Cake = ".\packages\tools\Cake", + [string]$Tools = ".\packages\tools", + [string]$Addins = ".\packages\addins", + [string]$Modules = ".\packages\modules", + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +Write-Host "Preparing to run build script..." + +# Should we use mono? +$UseMono = ""; +if($Mono.IsPresent) { + Write-Verbose -Message "Using the Mono based scripting engine." + $UseMono = "-mono" +} + +# Should we use the new Roslyn? +$UseExperimental = ""; +if($Experimental.IsPresent -and !($Mono.IsPresent)) { + Write-Verbose -Message "Using experimental version of Roslyn." + $UseExperimental = "-experimental" +} + +# Is this a dry run? +$UseDryRun = ""; +if($WhatIf.IsPresent) { + $UseDryRun = "-dryrun" +} + +Write-Verbose -Message "Using paket for dependency management..." + +# Make sure the .paket directory exits +$PaketDir = Resolve-Path $Paket +if(!(Test-Path $PaketDir)) { + Throw "Could not find .paket directory at $PaketDir" +} +Write-Verbose -Message "Found .paket in PATH at $PaketDir" + +# Set paket directory enviornment variable +$ENV:PAKET = $PaketDir + +# If paket.exe does not exits then download it using paket.bootstrapper.exe +$PAKET_EXE = Join-Path $PaketDir "paket.exe" +if (!(Test-Path $PAKET_EXE)) { + # If paket.bootstrapper.exe exits then run it. + $PAKET_BOOTSTRAPPER_EXE = Join-Path $PaketDir "paket.bootstrapper.exe" + if (!(Test-Path $PAKET_BOOTSTRAPPER_EXE)) { + Throw "Could not find paket.bootstrapper.exe at $PAKET_BOOTSTRAPPER_EXE" + } + Write-Verbose -Message "Found paket.bootstrapper.exe in PATH at $PAKET_BOOTSTRAPPER_EXE" + + # Download paket.exe + Write-Verbose -Message "Running paket.bootstrapper.exe to download paket.exe" + Invoke-Expression $PAKET_BOOTSTRAPPER_EXE + + if (!(Test-Path $PAKET_EXE)) { + Throw "Could not find paket.exe at $PAKET_EXE" + } +} +Write-Verbose -Message "Found paket.exe in PATH at $PAKET_EXE" + +# Install the dependencies +Write-Verbose -Message "Running paket.exe restore" +Invoke-Expression "$PAKET_EXE restore" + +# tools +if (Test-Path $Tools) { + $ToolsDir = Resolve-Path $Tools + $ENV:CAKE_PATHS_TOOLS = $ToolsDir +} +else { + Write-Verbose -Message "Could not find tools directory at $Tools" +} + +# addins +if (Test-Path $Addins) { + $AddinsDir = Resolve-Path $Addins + $ENV:CAKE_PATHS_ADDINS = $AddinsDir +} +else { + Write-Verbose -Message "Could not find addins directory at $Addins" +} + +# modules +if (Test-Path $Modules) { + $ModulesDir = Resolve-Path $Modules + $ENV:CAKE_PATHS_MODULES = $ModulesDir +} +else { + Write-Verbose -Message "Could not find modules directory at $Modules" +} + +# Make sure that Cake has been installed. +$CakeDir = Resolve-Path $Cake +$CAKE_EXE = Join-Path $CakeDir "Cake.exe" +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} +Write-Verbose -Message "Found Cake.exe in PATH at $CAKE_EXE" + +# Start Cake +Write-Host "Running build script..." +Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" +exit $LASTEXITCODE \ No newline at end of file diff --git a/paket.dependencies b/paket.dependencies index 19c3a72..ebb7747 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -1,45 +1,28 @@ source https://www.nuget.org/api/v2 -source https://www.myget.org/F/tpluscode/api/v3/index.json -framework: >= net45 +storage: none redirects: on copy_local: true -nuget fakeiteasy -nuget GitVersionTask -nuget JetBrainsAnnotations.Fody -nuget JetBrains.Annotations -nuget JsonLd.Entities -nuget Microsoft.Owin.Host.SystemWeb -nuget Microsoft.Owin.Hosting -nuget Nancy >= 2 prerelease -nuget Nancy.Owin >= 2 prerelease -nuget Nancy.Testing >= 2 prerelease -nuget NullGuard.Fody -nuget Resourcer.Fody -nuget StyleCop.Analyzers -nuget xunit -nuget fluentassertions -nuget TunnelVisionLabs.Net.UriTemplate prerelease -nuget GitLink < 3 -nuget Rdf.Vocabularies -nuget dotnetrdf -nuget json-ld.net -nuget nancy.rdf -nuget OpenCover -nuget ImpromptuInterface -nuget Dictionary -nuget Costura.Fody -nuget Nancy.Authentication.Basic >= 2 prerelease -nuget fody content: none -nuget tpluscode.UnitTests.Ruleset -nuget tpluscode.NoDocumentation.Ruleset -nuget tpluscode.Library.Ruleset -nuget Nancy.Routing.UriTemplates -nuget newtonsoft.json < 10 -nuget UriTemplateString - http https://gist.githubusercontent.com/tpluscode/5d9c6983004c1c9ec91f/raw/2a5f0785c2686635f1b8ab21af1751d276d02727/vocabulary.tt http https://raw.githubusercontent.com/HydraCG/Specifications/master/spec/latest/core/core.jsonld -http http://rdf-translator.appspot.com/convert/json-ld/xml/https%3A%2F%2Fraw.githubusercontent.com%2FHydraCG%2FSpecifications%2Fmaster%2Fspec%2Flatest%2Fcore%2Fcore.jsonld hydra.rdf \ No newline at end of file +http http://rdf-translator.appspot.com/convert/json-ld/xml/https%3A%2F%2Fraw.githubusercontent.com%2FHydraCG%2FSpecifications%2Fmaster%2Fspec%2Flatest%2Fcore%2Fcore.jsonld hydra.rdf + +group tools + source https://nuget.org/api/v2 + nuget Cake + nuget opencover + nuget codecov + nuget gitversion.commandline + nuget JetBrains.dotCover.CommandLineTools + nuget ReportGenerator + +group addins + source https://nuget.org/api/v2 + nuget cake.paket + nuget cake.codecov + +group modules + source https://nuget.org/api/v2 + nuget Cake.Paket.Module \ No newline at end of file diff --git a/paket.lock b/paket.lock index 81a76b6..7d208a2 100644 --- a/paket.lock +++ b/paket.lock @@ -1,107 +1,30 @@ REDIRECTS: ON +STORAGE: NONE COPY-LOCAL: TRUE -RESTRICTION: >= net45 -NUGET - remote: https://www.nuget.org/api/v2 - AngleSharp (0.9.9) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - AsyncUsageAnalyzers (1.0.0-alpha003) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - Costura.Fody (1.6.2) - Fody (>= 2.0 < 3.0) - Dictionary (2.1) - dotNetRDF (1.0.12) - HtmlAgilityPack (>= 1.4.9) - Newtonsoft.Json (>= 8.0.3) - VDS.Common (1.6.4) - FakeItEasy (4.3) - FluentAssertions (4.19.4) - Fody (2.2.1) - content: none - gitlink (2.4) - GitVersionTask (3.6.5) - HtmlAgilityPack (1.6.7) - ImpromptuInterface (6.2.2) - JetBrains.Annotations (11.1) - JetBrainsAnnotations.Fody (2.0) - Fody (>= 2.1.2) - json-ld.net (1.0.5) - Newtonsoft.Json (>= 6.0.4) - JsonLd.Entities (0.3.4) - json-ld.net (>= 1.0.5) - Newtonsoft.Json (>= 9.0) - Microsoft.NETCore.Platforms (2.0.1) - restriction: || (&& (>= monoandroid) (>= net45) (< netstandard1.0)) (&& (>= monotouch) (>= net45)) (&& (>= net45) (>= netcoreapp2.0)) (&& (>= net45) (< netstandard1.0) (>= portable-net451+win81+wpa81)) (&& (>= net45) (< netstandard1.3) (>= wpa81)) (&& (>= net45) (< portable-net45+win8+wpa81)) (&& (>= net45) (< portable-net451+win81+wpa81)) (&& (>= net45) (>= uap10.0)) (&& (>= net45) (>= xamarinios)) (&& (>= net45) (>= xamarinmac)) (&& (>= net45) (>= xamarintvos)) (&& (>= net45) (>= xamarinwatchos)) (&& (>= net451) (< net452) (< netstandard1.3)) (&& (< net452) (>= net46) (< netstandard1.4)) (&& (< net452) (>= net461)) - Microsoft.Owin (3.1) - Owin (>= 1.0) - Microsoft.Owin.Host.SystemWeb (3.1) - Microsoft.Owin (>= 3.1) - Owin (>= 1.0) - Microsoft.Owin.Hosting (3.1) - Microsoft.Owin (>= 3.1) - Owin (>= 1.0) - Nancy (2.0.0-clinteastwood) - Nancy.Authentication.Basic (2.0.0-clinteastwood) - AsyncUsageAnalyzers (>= 1.0.0-alpha003) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - Nancy (>= 2.0.0-clinteastwood) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - Nancy.Authentication.Forms (2.0.0-clinteastwood) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - AsyncUsageAnalyzers (>= 1.0.0-alpha003) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - Nancy (>= 2.0.0-clinteastwood) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - Nancy.Owin (2.0.0-clinteastwood) - AsyncUsageAnalyzers (>= 1.0.0-alpha003) - restriction: >= net452 - Nancy (>= 2.0.0-clinteastwood) - restriction: >= net452 - Owin (>= 1.0) - restriction: >= net452 - Nancy.Rdf (0.3) - dotNetRDF - JsonLd.Entities (>= 0.3.3) - Nancy (>= 2.0.0-barneyrubble) - Rdf.Vocabularies - Nancy.Routing.UriTemplates (0.1.1) - Nancy (>= 2.0.0-barneyrubble) - TunnelVisionLabs.Net.UriTemplate (>= 1.0.0-beta004) - UriTemplateString - Nancy.Testing (2.0.0-clinteastwood) - AngleSharp (>= 0.9.8.1) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - AsyncUsageAnalyzers (>= 1.0.0-alpha003) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - Nancy (>= 2.0.0-clinteastwood) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - Nancy.Authentication.Forms (>= 2.0.0-clinteastwood) - restriction: || (&& (>= net45) (>= netstandard1.6)) (>= net452) - NETStandard.Library (2.0.1) - restriction: && (>= net45) (< net452) - Microsoft.NETCore.Platforms (>= 1.1) - System.Runtime.InteropServices.RuntimeInformation (>= 4.3) - restriction: || (&& (>= net45) (< netstandard1.0) (>= portable-net451+win81+wpa81)) (&& (>= net45) (< netstandard1.3) (>= wpa81)) (&& (>= net45) (< portable-net451+win81+wpa81)) (&& (>= net45) (>= uap10.0)) (&& (>= net451) (< netstandard1.3)) (&& (>= net46) (< netstandard1.4)) - Newtonsoft.Json (9.0.1) - NullGuard.Fody (1.6.3) - Fody (>= 2.1.2) - OpenCover (4.6.519) - Owin (1.0) - Rdf.Vocabularies (1.2) - Resourcer.Fody (1.6.1) - Fody (>= 2.2.1) - StyleCop.Analyzers (1.0.2) - System.Runtime.InteropServices.RuntimeInformation (4.3) - restriction: || (&& (>= net45) (< netstandard1.0) (>= portable-net451+win81+wpa81)) (&& (>= net45) (< netstandard1.3) (>= wpa81)) (&& (>= net45) (< portable-net451+win81+wpa81)) (&& (>= net45) (>= uap10.0)) (&& (>= net451) (< net452) (< netstandard1.3)) (&& (< net452) (>= net46) (< netstandard1.4)) - TunnelVisionLabs.Net.UriTemplate (1.0.0-beta004) - UriTemplateString (0.2) - VDS.Common (1.6.4) - xunit (2.3.1) - xunit.analyzers (>= 0.7) - xunit.assert (2.3.1) - xunit.core (2.3.1) - xunit.abstractions (2.0.1) - xunit.analyzers (0.8) - xunit.assert (2.3.1) - NETStandard.Library (>= 1.6.1) - restriction: && (>= net45) (< net452) - xunit.core (2.3.1) - xunit.extensibility.core (2.3.1) - xunit.extensibility.execution (2.3.1) - xunit.extensibility.core (2.3.1) - NETStandard.Library (>= 1.6.1) - restriction: && (>= net45) (< net452) - xunit.abstractions (>= 2.0.1) - xunit.extensibility.execution (2.3.1) - NETStandard.Library (>= 1.6.1) - restriction: && (>= net45) (< net452) - xunit.extensibility.core (2.3.1) - remote: https://www.myget.org/F/tpluscode/api/v3/index.json - tpluscode.Library.Ruleset (1.1.0) - tpluscode.NoDocumentation.Ruleset (1.1.0) - tpluscode.UnitTests.Ruleset (1.1.0) HTTP remote: https://gist.githubusercontent.com vocabulary.tt (/tpluscode/5d9c6983004c1c9ec91f/raw/2a5f0785c2686635f1b8ab21af1751d276d02727/vocabulary.tt) remote: https://raw.githubusercontent.com core.jsonld (/HydraCG/Specifications/master/spec/latest/core/core.jsonld) remote: http://rdf-translator.appspot.com - hydra.rdf (/convert/json-ld/xml/https%3A%2F%2Fraw.githubusercontent.com%2FHydraCG%2FSpecifications%2Fmaster%2Fspec%2Flatest%2Fcore%2Fcore.jsonld) \ No newline at end of file + hydra.rdf (/convert/json-ld/xml/https%3A%2F%2Fraw.githubusercontent.com%2FHydraCG%2FSpecifications%2Fmaster%2Fspec%2Flatest%2Fcore%2Fcore.jsonld) +GROUP addins +NUGET + remote: https://www.nuget.org/api/v2 + Cake.Codecov (0.5) + Cake.Paket (4.0) + +GROUP modules +NUGET + remote: https://www.nuget.org/api/v2 + Cake.Paket.Module (4.0) + +GROUP tools +NUGET + remote: https://www.nuget.org/api/v2 + Cake (0.33) + Codecov (1.4) + GitVersion.CommandLine (4.0) + JetBrains.dotCover.CommandLineTools (2018.3.4) + OpenCover (4.7.922) + ReportGenerator (4.1.4) diff --git a/src/Argolis.Hydra.Nancy/Argolis.Hydra.Nancy.csproj b/src/Argolis.Hydra.Nancy/Argolis.Hydra.Nancy.csproj index 9f141c1..2ce94be 100644 --- a/src/Argolis.Hydra.Nancy/Argolis.Hydra.Nancy.csproj +++ b/src/Argolis.Hydra.Nancy/Argolis.Hydra.Nancy.csproj @@ -1,185 +1,55 @@  - - - - + - Debug - AnyCPU - {CBCAC4DC-129D-4F36-96D5-19B14F18CF18} Library - Properties Argolis.Hydra.Nancy Argolis.Hydra.Nancy - v4.5.2 - 512 - - - - true + netstandard2.0;net461 + false + false + false + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + false + false + false + true full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - bin\Debug\Argolis.Hydra.Nancy.xml - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - bin\Release\Argolis.Hydra.Nancy.xml + true + rdf;rest;hydra;nancy;semantic web;json-ld + MIT + https://github.com/wikibus/Argolis + https://github.com/wikibus/Argolis + git + https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - - - - - - Designer - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - Designer - - - {F8B427F1-AEEB-481B-8D51-A53AF4EF0813} - Argolis.Hydra - + - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - - - - - <__paket__Fody_targets>net452\Fody - - - - - <__paket__Fody_targets>netstandard1.2\Fody - - - - - <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody - - - - - - - - - ..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll - True - True - - - - - - - - - ..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll - True - True - - - - - - - - - ..\..\packages\Nancy\lib\net452\Nancy.dll - True - True - - - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\packages\NullGuard.Fody\lib\netstandard1.0\NullGuard.dll - True - True - - - - - - - - - ..\..\packages\Rdf.Vocabularies\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Rdf.Vocabularies.dll - True - True - - - - - - - - True - - - True - + + all + runtime; build; native; contentfiles; analyzers + + + + all + + + all + + + all + + + + + all + \ No newline at end of file diff --git a/src/Argolis.Hydra.Nancy/FodyWeavers.xml b/src/Argolis.Hydra.Nancy/FodyWeavers.xml index a4cb88b..e888f0c 100644 --- a/src/Argolis.Hydra.Nancy/FodyWeavers.xml +++ b/src/Argolis.Hydra.Nancy/FodyWeavers.xml @@ -1,5 +1,4 @@ - - + + - \ No newline at end of file diff --git a/src/Argolis.Hydra.Nancy/FodyWeavers.xsd b/src/Argolis.Hydra.Nancy/FodyWeavers.xsd new file mode 100644 index 0000000..f4d1bb6 --- /dev/null +++ b/src/Argolis.Hydra.Nancy/FodyWeavers.xsd @@ -0,0 +1,63 @@ + + + + + + + + + + + Used to control whether asserts are added into debug builds or not. + + + + + The operation mode of NullGuard. + + + + + + Automatically detect the mode by the usage of JetBrains.Annotations. + + + + + In implicit mode everything is assumed to be not-null, unless attributed with [AllowNull]. + + + + + In explicit mode everything is assumed to be nullable, unless attributed with [NotNull]. + + + + + + + + A regular expression to specify the names of a classes to exclude from NullGuard. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/src/Argolis.Hydra.Nancy/HydraRegistrations.cs b/src/Argolis.Hydra.Nancy/HydraRegistrations.cs index 81e2bc6..408d3c6 100644 --- a/src/Argolis.Hydra.Nancy/HydraRegistrations.cs +++ b/src/Argolis.Hydra.Nancy/HydraRegistrations.cs @@ -2,6 +2,8 @@ using Argolis.Hydra.Discovery.SupportedClasses; using Argolis.Hydra.Discovery.SupportedOperations; using Argolis.Hydra.Discovery.SupportedProperties; +using Argolis.Hydra.Models; +using Argolis.Models; using JsonLD.Entities; using Nancy; using Nancy.Bootstrapper; @@ -30,6 +32,8 @@ public HydraRegistrations(ITypeCatalog catalog) this.RegisterWithDefault(typeof(DefaultPropertyRangeRetrievalPolicy), Lifetime.PerRequest); this.RegisterWithDefault(typeof(DefaultSupportedOperationFactory), Lifetime.PerRequest); this.RegisterWithDefault(typeof(NullContextProvider)); + this.RegisterWithDefault(typeof(DefaultUriTemplateExpander)); + this.RegisterWithDefault(typeof(DefaultUriTemplateMatcher)); this.RegisterWithDefault(typeof(IriTemplateFactory), Lifetime.PerRequest); this.RegisterWithUserThenDefault(new[] { diff --git a/src/Argolis.Hydra.Nancy/Properties/AssemblyInfo.cs b/src/Argolis.Hydra.Nancy/Properties/AssemblyInfo.cs index dac6590..cb81193 100644 --- a/src/Argolis.Hydra.Nancy/Properties/AssemblyInfo.cs +++ b/src/Argolis.Hydra.Nancy/Properties/AssemblyInfo.cs @@ -5,3 +5,7 @@ [assembly: AssemblyDescription("Nancy integration for Hydra, the hypermedia API description language")] [assembly: Guid("1d4cf50b-72e7-4303-bc56-afe8215dee53")] + +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyInformationalVersion("0.3.0-net-standard.1+17.Branch.net-standard.Sha.135579857255b4ca1996cbd6ed4ed93bcbe122fd")] diff --git a/src/Argolis.Hydra.Nancy/Settings.StyleCop b/src/Argolis.Hydra.Nancy/Settings.StyleCop deleted file mode 100644 index bc74059..0000000 --- a/src/Argolis.Hydra.Nancy/Settings.StyleCop +++ /dev/null @@ -1,10 +0,0 @@ - - - VersionAssemblyInfo.cs - - - False - - - - \ No newline at end of file diff --git a/src/Argolis.Hydra.Nancy/app.config b/src/Argolis.Hydra.Nancy/app.config deleted file mode 100644 index aec6830..0000000 --- a/src/Argolis.Hydra.Nancy/app.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - True - - - - diff --git a/src/Argolis.Hydra.Nancy/paket.references b/src/Argolis.Hydra.Nancy/paket.references deleted file mode 100644 index 5c2e534..0000000 --- a/src/Argolis.Hydra.Nancy/paket.references +++ /dev/null @@ -1,8 +0,0 @@ -Nancy -NullGuard.Fody -JetBrainsAnnotations.Fody -GitVersionTask -StyleCop.Analyzers -JsonLD.Entities -Rdf.Vocabularies -tpluscode.Library.Ruleset \ No newline at end of file diff --git a/src/Argolis.Hydra.Nancy/paket.template b/src/Argolis.Hydra.Nancy/paket.template deleted file mode 100644 index f28dd20..0000000 --- a/src/Argolis.Hydra.Nancy/paket.template +++ /dev/null @@ -1,21 +0,0 @@ -type project -id Argolis.Hydra.Nancy -include-pdbs true -excludeddependencies - JsonLd.Entities - GitVersionTask - tpluscode.Library.Ruleset - JetBrains.Annotations - Nancy -dependencies - Nancy.Rdf >= LOCKEDVERSION -iconUrl - https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png -tags - rdf rest hydra nancy semantic web json-ld -copyright - Copyright 2016 Tomasz Pluskiewicz -licenseUrl - http://www.opensource.org/licenses/mit-license.php -projectUrl - https://github.com/wikibus/Argolis diff --git a/src/Argolis.Hydra/Argolis.Hydra.ExternalAnnotations.xml b/src/Argolis.Hydra/Argolis.Hydra.ExternalAnnotations.xml new file mode 100644 index 0000000..e9b6fcd --- /dev/null +++ b/src/Argolis.Hydra/Argolis.Hydra.ExternalAnnotations.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Argolis.Hydra/Argolis.Hydra.csproj b/src/Argolis.Hydra/Argolis.Hydra.csproj index d243922..4eb5b4e 100644 --- a/src/Argolis.Hydra/Argolis.Hydra.csproj +++ b/src/Argolis.Hydra/Argolis.Hydra.csproj @@ -1,286 +1,67 @@  - - - - + - Debug - AnyCPU - {F8B427F1-AEEB-481B-8D51-A53AF4EF0813} - Library - Properties Argolis.Hydra Argolis.Hydra - v4.5.2 - 512 - - - - true + netstandard2.0;net461;netcoreapp2.0 + false + false + false + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + false + false + false full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - bin\Debug\Lernaean.Hydra.XML - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - bin\Release\Lernaean.Hydra.XML + true + rdf;rest;hydra;nancy;semantic web;json-ld + MIT + https://github.com/wikibus/Argolis + https://github.com/wikibus/Argolis + git + https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - - - - - - - - Designer - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - context.jsonld - - - - - + + Properties\CommonAssemblyInfo.cs + - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - - - - - <__paket__Fody_targets>net452\Fody - - - - - <__paket__Fody_targets>netstandard1.2\Fody - - - - - <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody - - - - - - {3FADEBA7-BEA0-4864-B3FD-C17EAC737B35} - Argolis.Models - + - - - - - ..\..\packages\JetBrains.Annotations\lib\net20\JetBrains.Annotations.dll - True - True - - - - - - - - - ..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll - True - True - - - - - - - - - ..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll - True - True - - - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\packages\NullGuard.Fody\lib\netstandard1.0\NullGuard.dll - True - True - - - - - - - - - ..\..\packages\Rdf.Vocabularies\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Rdf.Vocabularies.dll - True - True - - - - - - - - - ..\..\packages\Resourcer.Fody\lib\net452\Resourcer.dll - True - True - - - - - - - - True - - - True - - - - - - - ..\..\packages\TunnelVisionLabs.Net.UriTemplate\lib\net20\TunnelVisionLabs.Net.UriTemplate.dll - True - True - - - - - - - - - ..\..\packages\UriTemplateString\lib\net45\UriTemplateString.dll - True - True - - - - + + all + runtime; build; native; contentfiles; analyzers + + + all + + + all + + + + all + + + all + + + all + + + all + + + + + + + all + + \ No newline at end of file diff --git a/src/Argolis.Hydra/FodyWeavers.xml b/src/Argolis.Hydra/FodyWeavers.xml index f783d39..976527c 100644 --- a/src/Argolis.Hydra/FodyWeavers.xml +++ b/src/Argolis.Hydra/FodyWeavers.xml @@ -1,5 +1,5 @@ - - + + diff --git a/src/Argolis.Hydra/FodyWeavers.xsd b/src/Argolis.Hydra/FodyWeavers.xsd new file mode 100644 index 0000000..7e060cc --- /dev/null +++ b/src/Argolis.Hydra/FodyWeavers.xsd @@ -0,0 +1,65 @@ + + + + + + + + + + + + Used to control whether asserts are added into debug builds or not. + + + + + The operation mode of NullGuard. + + + + + + Automatically detect the mode by the usage of JetBrains.Annotations. + + + + + In implicit mode everything is assumed to be not-null, unless attributed with [AllowNull]. + + + + + In explicit mode everything is assumed to be nullable, unless attributed with [NotNull]. + + + + + + + + A regular expression to specify the names of a classes to exclude from NullGuard. + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/src/Argolis.Models.TunnelVisionLabs/TunnelVisionLabsUriTemplateExpander.cs b/src/Argolis.Hydra/Models/DefaultUriTemplateExpander.cs similarity index 78% rename from src/Argolis.Models.TunnelVisionLabs/TunnelVisionLabsUriTemplateExpander.cs rename to src/Argolis.Hydra/Models/DefaultUriTemplateExpander.cs index a3d0345..01844c1 100644 --- a/src/Argolis.Models.TunnelVisionLabs/TunnelVisionLabsUriTemplateExpander.cs +++ b/src/Argolis.Hydra/Models/DefaultUriTemplateExpander.cs @@ -1,22 +1,21 @@ using System; using System.Collections.Generic; -using DictionaryLibrary; -using TunnelVisionLabs.Net; +using Argolis.Models; -namespace Argolis.Models.TunnelVisionLabs +namespace Argolis.Hydra.Models { /// /// URI Template expander implemented with TunnelVisionLabs.Net.UriTemplate package /// - public class TunnelVisionLabsUriTemplateExpander : IUriTemplateExpander + public class DefaultUriTemplateExpander : IUriTemplateExpander { private readonly IModelTemplateProvider templates; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The template provider. - public TunnelVisionLabsUriTemplateExpander(IModelTemplateProvider templates) + public DefaultUriTemplateExpander(IModelTemplateProvider templates) { this.templates = templates; } @@ -51,7 +50,7 @@ public Uri ExpandAbsolute(object parameters) private Uri Expand(string templateString, IDictionary parameters) { - return new UriTemplate(templateString).BindByName(parameters); + return new UriTemplate.Core.UriTemplate(templateString).BindByName(parameters); } } } \ No newline at end of file diff --git a/src/Argolis.Models.TunnelVisionLabs/TunnelVisionLabsUriTemplateMatcher.cs b/src/Argolis.Hydra/Models/DefaultUriTemplateMatcher.cs similarity index 71% rename from src/Argolis.Models.TunnelVisionLabs/TunnelVisionLabsUriTemplateMatcher.cs rename to src/Argolis.Hydra/Models/DefaultUriTemplateMatcher.cs index e03c71b..497b31b 100644 --- a/src/Argolis.Models.TunnelVisionLabs/TunnelVisionLabsUriTemplateMatcher.cs +++ b/src/Argolis.Hydra/Models/DefaultUriTemplateMatcher.cs @@ -1,22 +1,22 @@ using System; using System.Linq; -using TunnelVisionLabs.Net; +using Argolis.Models; -namespace Argolis.Models.TunnelVisionLabs +namespace Argolis.Hydra.Models { /// /// Implements with TunnelVisionLabs.Net.UriTemplate package /// /// - public class TunnelVisionLabsUriTemplateMatcher : IUriTemplateMatcher + public class DefaultUriTemplateMatcher : IUriTemplateMatcher { private readonly IModelTemplateProvider templates; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The template provider. - public TunnelVisionLabsUriTemplateMatcher(IModelTemplateProvider templates) + public DefaultUriTemplateMatcher(IModelTemplateProvider templates) { this.templates = templates; } @@ -28,7 +28,7 @@ public UriTemplateMatches Match(Uri uri) ? this.templates.GetAbsoluteTemplate(typeof(T)) : this.templates.GetTemplate(typeof(T)); - var tunnelVisionMatches = new UriTemplate(template).Match(uri); + var tunnelVisionMatches = new UriTemplate.Core.UriTemplate(template).Match(uri); if (tunnelVisionMatches != null) { var matchDict = tunnelVisionMatches.Bindings.Values.ToDictionary(m => m.Key.Name, m => m.Value); diff --git a/src/Argolis.Hydra/Models/DictionaryMaker.cs b/src/Argolis.Hydra/Models/DictionaryMaker.cs new file mode 100644 index 0000000..7a3ddf6 --- /dev/null +++ b/src/Argolis.Hydra/Models/DictionaryMaker.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Reflection; + +namespace Argolis.Hydra.Models +{ + /// + /// Makes a dictionary out of a given object. + /// + internal static class DictionaryMaker + { + /// + /// Makes a dictionary out of the properties of the given input. + /// + /// Object to make a dictionary out of + /// + /// A dictionary with the keys being the input object property names and the values their respective values + /// + public static IDictionary Make(object input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + if (input is IDictionary objects) + { + return objects; + } + + var properties = input.GetType().GetTypeInfo().GetProperties(); + var fields = input.GetType().GetTypeInfo().GetFields(); + var members = properties.Cast().Concat(fields); + + return members.ToDictionary(m => m.Name, m => GetValue(input, m)); + } + + /// + /// Makes a dictionary out of the properties of the given input. + /// + /// Object to make a dictionary out of + /// + /// A dictionary with the keys being the input object property names and the values their respective types and + /// values + /// + public static IDictionary> MakeWithType(object input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + if (input is IDictionary objects) + { + return objects.ToDictionary(o => o.Key, o => o.Value == null + ? new Tuple(typeof(object), o.Value) + : new Tuple(o.Value.GetType(), o.Value)); + } + + var dict = new Dictionary>(); + + foreach (var property in input.GetType().GetTypeInfo().GetProperties()) + { + dict.Add(property.Name, new Tuple(property.PropertyType, property.GetValue(input, null))); + } + + foreach (var field in input.GetType().GetTypeInfo().GetFields()) + { + dict.Add(field.Name, new Tuple(field.FieldType, field.GetValue(input))); + } + + return dict; + } + + [SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "It's necessary.")] + private static object GetValue(object obj, MemberInfo member) + { + if (member is PropertyInfo propertyInfo) + { + return propertyInfo.GetValue(obj, null); + } + + if (member is FieldInfo info) + { + return info.GetValue(obj); + } + + throw new ArgumentException("Passed member is neither a PropertyInfo nor a FieldInfo."); + } + } +} diff --git a/src/Argolis.Hydra/Properties/AssemblyInfo.cs b/src/Argolis.Hydra/Properties/AssemblyInfo.cs index 7860beb..a5864fc 100644 --- a/src/Argolis.Hydra/Properties/AssemblyInfo.cs +++ b/src/Argolis.Hydra/Properties/AssemblyInfo.cs @@ -5,3 +5,7 @@ [assembly: AssemblyDescription("Core library for Hydra, the hypermedia API description language")] [assembly: Guid("b9cfe648-af87-4df3-adc2-04b550bfa1bb")] + +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyInformationalVersion("0.3.0-net-standard.1+17.Branch.net-standard.Sha.135579857255b4ca1996cbd6ed4ed93bcbe122fd")] diff --git a/src/Argolis.Hydra/Resources/TemplatedPartialCollectionView.cs b/src/Argolis.Hydra/Resources/TemplatedPartialCollectionView.cs index 12b3ce2..1c63f32 100644 --- a/src/Argolis.Hydra/Resources/TemplatedPartialCollectionView.cs +++ b/src/Argolis.Hydra/Resources/TemplatedPartialCollectionView.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using JsonLD.Entities; using NullGuard; -using TunnelVisionLabs.Net; namespace Argolis.Hydra.Resources { @@ -12,7 +11,7 @@ namespace Argolis.Hydra.Resources [NullGuard(ValidationFlags.AllPublic ^ ValidationFlags.Properties)] public class TemplatedPartialCollectionView : PartialCollectionView { - private readonly UriTemplate template; + private readonly UriTemplate.Core.UriTemplate template; private readonly string pageVariable; private readonly IDictionary templateParams; private readonly int totalPages; @@ -30,7 +29,7 @@ public class TemplatedPartialCollectionView : PartialCollectionView /// page size, used to calculate last page index /// additional template parameters public TemplatedPartialCollectionView( - UriTemplate template, + UriTemplate.Core.UriTemplate template, string pageVariable, long totalItems, int page, diff --git a/src/Argolis.Hydra/Serialization/VariableRepresentationConverter.cs b/src/Argolis.Hydra/Serialization/VariableRepresentationConverter.cs index 4af6fd9..5168127 100644 --- a/src/Argolis.Hydra/Serialization/VariableRepresentationConverter.cs +++ b/src/Argolis.Hydra/Serialization/VariableRepresentationConverter.cs @@ -12,13 +12,11 @@ internal class VariableRepresentationConverter : JsonConverter /// public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { - if (value is VariableRepresentation variableRepresentation) + if (value is VariableRepresentation) { - var uri = Vocab.Hydra.BaseUri + variableRepresentation; - writer.WriteStartObject(); writer.WritePropertyName(JsonLdKeywords.Id); - writer.WriteValue(uri); + writer.WriteValue(Vocab.Hydra.BaseUri + value); writer.WriteEndObject(); } else diff --git a/src/Argolis.Hydra/Settings.StyleCop b/src/Argolis.Hydra/Settings.StyleCop deleted file mode 100644 index bc74059..0000000 --- a/src/Argolis.Hydra/Settings.StyleCop +++ /dev/null @@ -1,10 +0,0 @@ - - - VersionAssemblyInfo.cs - - - False - - - - \ No newline at end of file diff --git a/src/Argolis.Hydra/app.config b/src/Argolis.Hydra/app.config deleted file mode 100644 index 5166e0b..0000000 --- a/src/Argolis.Hydra/app.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - True - - - - diff --git a/src/Argolis.Hydra/paket.references b/src/Argolis.Hydra/paket.references deleted file mode 100644 index 293f740..0000000 --- a/src/Argolis.Hydra/paket.references +++ /dev/null @@ -1,11 +0,0 @@ -NullGuard.Fody -JsonLd.Entities -JetBrainsAnnotations.Fody -JetBrains.Annotations -Resourcer.Fody -GitVersionTask -TunnelVisionLabs.Net.UriTemplate -StyleCop.Analyzers -Rdf.Vocabularies -tpluscode.Library.Ruleset -UriTemplateString \ No newline at end of file diff --git a/src/Argolis.Hydra/paket.template b/src/Argolis.Hydra/paket.template deleted file mode 100644 index 2dec1de..0000000 --- a/src/Argolis.Hydra/paket.template +++ /dev/null @@ -1,23 +0,0 @@ -type project -id Argolis.Hydra -include-pdbs true -excludeddependencies - GitVersionTask - tpluscode.Library.Ruleset - JetBrains.Annotations -dependencies - JsonLd.Entities >= LOCKEDVERSION - Rdf.Vocabularies >= LOCKEDVERSION -frameworkAssemblies - System.Runtime.Serialization - System.ComponentModel.DataAnnotations -iconUrl - https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png -tags - rdf rest hydra nancy semantic web json-ld -copyright - Copyright 2016 Tomasz Pluskiewicz -licenseUrl - http://www.opensource.org/licenses/mit-license.php -projectUrl - https://github.com/wikibus/Argolis diff --git a/src/Argolis.Models.TunnelVisionLabs/Argolis.Models.TunnelVisionLabs.csproj b/src/Argolis.Models.TunnelVisionLabs/Argolis.Models.TunnelVisionLabs.csproj deleted file mode 100644 index ab1d3a6..0000000 --- a/src/Argolis.Models.TunnelVisionLabs/Argolis.Models.TunnelVisionLabs.csproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - Debug - AnyCPU - {6AC20D75-35CF-4385-912E-BC7E381AD3A0} - Library - Properties - Argolis.Models.TunnelVisionLabs - Argolis.Models.TunnelVisionLabs - v4.5.2 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - {3FADEBA7-BEA0-4864-B3FD-C17EAC737B35} - Argolis.Models - - - - - Designer - - - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - - - - - <__paket__Fody_targets>net452\Fody - - - - - <__paket__Fody_targets>netstandard1.2\Fody - - - - - <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody - - - - - - - - ..\..\packages\Dictionary\lib\Dictionary.dll - True - True - - - - - - - - - ..\..\packages\NullGuard.Fody\lib\netstandard1.0\NullGuard.dll - True - True - - - - - - - - - ..\..\packages\TunnelVisionLabs.Net.UriTemplate\lib\net20\TunnelVisionLabs.Net.UriTemplate.dll - True - True - - - - - - - \ No newline at end of file diff --git a/src/Argolis.Models.TunnelVisionLabs/FodyWeavers.xml b/src/Argolis.Models.TunnelVisionLabs/FodyWeavers.xml deleted file mode 100644 index e315ec6..0000000 --- a/src/Argolis.Models.TunnelVisionLabs/FodyWeavers.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - Dictionary - - - \ No newline at end of file diff --git a/src/Argolis.Models.TunnelVisionLabs/Properties/AssemblyInfo.cs b/src/Argolis.Models.TunnelVisionLabs/Properties/AssemblyInfo.cs deleted file mode 100644 index 6193f4e..0000000 --- a/src/Argolis.Models.TunnelVisionLabs/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Handling IRI Templates with TunnelVisionLabs")] -[assembly: Guid("6ac20d75-35cf-4385-912e-bc7e381ad3a0")] \ No newline at end of file diff --git a/src/Argolis.Models.TunnelVisionLabs/paket.references b/src/Argolis.Models.TunnelVisionLabs/paket.references deleted file mode 100644 index 31c944a..0000000 --- a/src/Argolis.Models.TunnelVisionLabs/paket.references +++ /dev/null @@ -1,5 +0,0 @@ -NullGuard.Fody -GitVersionTask -TunnelVisionLabs.Net.UriTemplate -tpluscode.Library.Ruleset -Dictionary \ No newline at end of file diff --git a/src/Argolis.Models.TunnelVisionLabs/paket.template b/src/Argolis.Models.TunnelVisionLabs/paket.template deleted file mode 100644 index c8e7e36..0000000 --- a/src/Argolis.Models.TunnelVisionLabs/paket.template +++ /dev/null @@ -1,19 +0,0 @@ -type project -id Argolis.Models.TunnelVisionLabs -include-pdbs true -excludeddependencies - GitVersionTask - Dictionary - Costura.Fody -dependencies - TunnelVisionLabs.Net.UriTemplate >= LOCKEDVERSION -iconUrl - https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png -tags - rdf rest nancy semantic web -copyright - Copyright 2016 Tomasz Pluskiewicz -licenseUrl - http://www.opensource.org/licenses/mit-license.php -projectUrl - https://github.com/wikibus/Argolis diff --git a/src/Argolis.Models/Argolis.Models.csproj b/src/Argolis.Models/Argolis.Models.csproj index bbacb5a..31a6dbc 100644 --- a/src/Argolis.Models/Argolis.Models.csproj +++ b/src/Argolis.Models/Argolis.Models.csproj @@ -1,124 +1,48 @@  - - - + - Debug - AnyCPU - {3FADEBA7-BEA0-4864-B3FD-C17EAC737B35} Library - Properties Argolis.Models Argolis.Models - v4.5 - 512 - - - true + netstandard1.5 + false + false + false + false + false + false + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Argolis.Models.XML - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Argolis.Models.XML + true + rdf;rest;nancy;semantic web + MIT + https://github.com/wikibus/Argolis + https://github.com/wikibus/Argolis + git + https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - - - - - <__paket__Fody_targets>net452\Fody - - - - - <__paket__Fody_targets>netstandard1.2\Fody - - - - - <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody - - - - - - - Designer - - - - - - ..\..\packages\NullGuard.Fody\lib\netstandard1.0\NullGuard.dll - True - True - - - - - - - - True - - - True - + + all + runtime; build; native; contentfiles; analyzers + + + all + + + all + + + all + + + all + \ No newline at end of file diff --git a/src/Argolis.Models/AttributeModelTemplateProvider.cs b/src/Argolis.Models/AttributeModelTemplateProvider.cs index 6ae9ed3..c828c4e 100644 --- a/src/Argolis.Models/AttributeModelTemplateProvider.cs +++ b/src/Argolis.Models/AttributeModelTemplateProvider.cs @@ -59,12 +59,12 @@ protected virtual TemplateAttributeBase GetTemplateAttribute(Type type) { if (type.IsConstructedGenericType) { - var genericTypeAttributes = type.GetGenericArguments()[0].GetCustomAttributes(); + var genericTypeAttributes = type.GetTypeInfo().GetGenericArguments()[0].GetTypeInfo().GetCustomAttributes(); return genericTypeAttributes.First(attr => attr.ContainerType.TypeHandle.Equals(type.GetGenericTypeDefinition().TypeHandle)); } - return type.GetCustomAttribute(); + return type.GetTypeInfo().GetCustomAttribute(); } private string GetIdentifierTemplate(Type type) diff --git a/src/Argolis.Models/FodyWeavers.xml b/src/Argolis.Models/FodyWeavers.xml index a4cb88b..e888f0c 100644 --- a/src/Argolis.Models/FodyWeavers.xml +++ b/src/Argolis.Models/FodyWeavers.xml @@ -1,5 +1,4 @@ - - + + - \ No newline at end of file diff --git a/src/Argolis.Models/FodyWeavers.xsd b/src/Argolis.Models/FodyWeavers.xsd new file mode 100644 index 0000000..f4d1bb6 --- /dev/null +++ b/src/Argolis.Models/FodyWeavers.xsd @@ -0,0 +1,63 @@ + + + + + + + + + + + Used to control whether asserts are added into debug builds or not. + + + + + The operation mode of NullGuard. + + + + + + Automatically detect the mode by the usage of JetBrains.Annotations. + + + + + In implicit mode everything is assumed to be not-null, unless attributed with [AllowNull]. + + + + + In explicit mode everything is assumed to be nullable, unless attributed with [NotNull]. + + + + + + + + A regular expression to specify the names of a classes to exclude from NullGuard. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/src/Argolis.Models/GenericResourceIdentifierTemplateAttribute.cs b/src/Argolis.Models/GenericResourceIdentifierTemplateAttribute.cs index 66749d8..2060788 100644 --- a/src/Argolis.Models/GenericResourceIdentifierTemplateAttribute.cs +++ b/src/Argolis.Models/GenericResourceIdentifierTemplateAttribute.cs @@ -17,7 +17,7 @@ public abstract class GenericResourceIdentifierTemplateAttribute : TemplateAttri protected GenericResourceIdentifierTemplateAttribute(string template, Type containerType) : base(template) { - if (containerType.IsGenericTypeDefinition == false) + if (containerType.GetTypeInfo().IsGenericTypeDefinition == false) { throw new ArgumentException("Container type must be a generic type", nameof(containerType)); } diff --git a/src/Argolis.Models/Properties/AssemblyInfo.cs b/src/Argolis.Models/Properties/AssemblyInfo.cs index d365484..da63131 100644 --- a/src/Argolis.Models/Properties/AssemblyInfo.cs +++ b/src/Argolis.Models/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ using System.Reflection; -using System.Runtime.InteropServices; [assembly: AssemblyTitle("Argolis helpers for resources")] [assembly: AssemblyDescription("Library for simpler working with URI identifiers for resources")] -[assembly: Guid("3fadeba7-bea0-4864-b3fd-c17eac737b35")] + +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyInformationalVersion("0.3.0-net-standard.1+17.Branch.net-standard.Sha.135579857255b4ca1996cbd6ed4ed93bcbe122fd")] diff --git a/src/Argolis.Models/paket.references b/src/Argolis.Models/paket.references deleted file mode 100644 index a9b9332..0000000 --- a/src/Argolis.Models/paket.references +++ /dev/null @@ -1,5 +0,0 @@ -NullGuard.Fody -GitVersionTask -StyleCop.Analyzers -JetBrainsAnnotations.Fody -tpluscode.Library.Ruleset \ No newline at end of file diff --git a/src/Argolis.Models/paket.template b/src/Argolis.Models/paket.template deleted file mode 100644 index 2e3ea1e..0000000 --- a/src/Argolis.Models/paket.template +++ /dev/null @@ -1,15 +0,0 @@ -type project -id Argolis.Models -include-pdbs true -excludeddependencies - GitVersionTask -iconUrl - https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png -tags - rdf rest nancy semantic web -copyright - Copyright 2016 Tomasz Pluskiewicz -licenseUrl - http://www.opensource.org/licenses/mit-license.php -projectUrl - https://github.com/wikibus/Argolis diff --git a/src/Argolis.Nancy/Argolis.Nancy.csproj b/src/Argolis.Nancy/Argolis.Nancy.csproj index 7646547..4abce6d 100644 --- a/src/Argolis.Nancy/Argolis.Nancy.csproj +++ b/src/Argolis.Nancy/Argolis.Nancy.csproj @@ -1,175 +1,56 @@  - - - + - Debug - AnyCPU - {4EC11162-751B-4E73-A3C6-435BD7CAE9BA} - Library - Properties Argolis.Nancy Argolis.Nancy - v4.5.2 - 512 - - - true + netstandard2.0;net461 + false + false + false + false + false + false + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - bin\Debug\Lernaean.Hydra.Nancy.XML - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - bin\Release\Lernaean.Hydra.Nancy.XML + true + rdf;rest;nancy;semantic web;json-ld + MIT + https://github.com/wikibus/Argolis + https://github.com/wikibus/Argolis + git + https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - - + - - - Properties\CommonAssemblyInfo.cs - - - - - - - {cbcac4dc-129d-4f36-96d5-19b14f18cf18} - Argolis.Hydra.Nancy - - - {f8b427f1-aeeb-481b-8d51-a53af4ef0813} - Argolis.Hydra - - - {3FADEBA7-BEA0-4864-B3FD-C17EAC737B35} - Argolis.Models - - - - - - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - - - - - <__paket__Fody_targets>net452\Fody - - - - - <__paket__Fody_targets>netstandard1.2\Fody - - - - - <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody - - - - - - Designer - + - - - - - ..\..\packages\Nancy\lib\net452\Nancy.dll - True - True - - - - - - - - - ..\..\packages\Nancy.Routing.UriTemplates\lib\net452\Nancy.Routing.UriTemplates.dll - True - True - - - - - - - - - ..\..\packages\NullGuard.Fody\lib\netstandard1.0\NullGuard.dll - True - True - - - - - - - - True - - - True - + + all + runtime; build; native; contentfiles; analyzers + + + all + + + all + + + all + + + + + + all + - - - - - ..\..\packages\TunnelVisionLabs.Net.UriTemplate\lib\net20\TunnelVisionLabs.Net.UriTemplate.dll - True - True - - - - - - - - - ..\..\packages\UriTemplateString\lib\net45\UriTemplateString.dll - True - True - - - - \ No newline at end of file diff --git a/src/Argolis.Nancy/FodyWeavers.xml b/src/Argolis.Nancy/FodyWeavers.xml index b1e2849..e888f0c 100644 --- a/src/Argolis.Nancy/FodyWeavers.xml +++ b/src/Argolis.Nancy/FodyWeavers.xml @@ -1,4 +1,4 @@ - - + + \ No newline at end of file diff --git a/src/Argolis.Nancy/FodyWeavers.xsd b/src/Argolis.Nancy/FodyWeavers.xsd new file mode 100644 index 0000000..f4d1bb6 --- /dev/null +++ b/src/Argolis.Nancy/FodyWeavers.xsd @@ -0,0 +1,63 @@ + + + + + + + + + + + Used to control whether asserts are added into debug builds or not. + + + + + The operation mode of NullGuard. + + + + + + Automatically detect the mode by the usage of JetBrains.Annotations. + + + + + In implicit mode everything is assumed to be not-null, unless attributed with [AllowNull]. + + + + + In explicit mode everything is assumed to be nullable, unless attributed with [NotNull]. + + + + + + + + A regular expression to specify the names of a classes to exclude from NullGuard. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/src/Argolis.Nancy/Properties/AssemblyInfo.cs b/src/Argolis.Nancy/Properties/AssemblyInfo.cs index b5ecb0c..ae94a4f 100644 --- a/src/Argolis.Nancy/Properties/AssemblyInfo.cs +++ b/src/Argolis.Nancy/Properties/AssemblyInfo.cs @@ -4,3 +4,7 @@ [assembly: AssemblyTitle("Argolis.Nancy")] [assembly: AssemblyDescription("Meta-package for installing Argolis in Nancy application")] [assembly: Guid("4ec11162-751b-4e73-a3c6-435bd7cae9ba")] + +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyInformationalVersion("0.3.0-net-standard.1+17.Branch.net-standard.Sha.135579857255b4ca1996cbd6ed4ed93bcbe122fd")] diff --git a/src/Argolis.Nancy/paket.references b/src/Argolis.Nancy/paket.references deleted file mode 100644 index 7652734..0000000 --- a/src/Argolis.Nancy/paket.references +++ /dev/null @@ -1,6 +0,0 @@ -NullGuard.Fody -GitVersionTask -StyleCop.Analyzers -Nancy -Nancy.Routing.UriTemplates -tpluscode.Library.Ruleset \ No newline at end of file diff --git a/src/Argolis.Nancy/paket.template b/src/Argolis.Nancy/paket.template deleted file mode 100644 index f2c1e8a..0000000 --- a/src/Argolis.Nancy/paket.template +++ /dev/null @@ -1,16 +0,0 @@ -type project -id Argolis.Nancy -excludeddependencies - GitVersionTask -dependencies - Nancy >= LOCKEDVERSION -iconUrl - https://raw.githubusercontent.com/wikibus/Argolis/master/assets/logo.png -tags - rdf rest hydra nancy semantic web json-ld -copyright - Copyright 2016 Tomasz Pluskiewicz -licenseUrl - http://www.opensource.org/licenses/mit-license.php -projectUrl - https://github.com/wikibus/Argolis diff --git a/src/Argolis.Tests.Integration/Argolis.Tests.Integration.csproj b/src/Argolis.Tests.Integration/Argolis.Tests.Integration.csproj index df8f92d..6de8fa4 100644 --- a/src/Argolis.Tests.Integration/Argolis.Tests.Integration.csproj +++ b/src/Argolis.Tests.Integration/Argolis.Tests.Integration.csproj @@ -1,321 +1,74 @@  - - - - + - Debug - AnyCPU - {41F8C2F5-8B83-430B-9AFE-21DCFD84AF54} - Library - Properties Argolis.Tests.Integration Argolis.Tests.Integration - v4.5.2 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + netcoreapp2.0 + false + false + false + false + false + false + true + NU1605 - - - - - - - - - - - Designer - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - {1d2e686f-381d-4700-b062-67ac029c0daf} - TestNancyApp - - - {cbcac4dc-129d-4f36-96d5-19b14f18cf18} - Argolis.Hydra.Nancy - - - {f8b427f1-aeeb-481b-8d51-a53af4ef0813} - Argolis.Hydra - - - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - - - - - - - ..\..\packages\AngleSharp\lib\net45\AngleSharp.dll - True - True - - - - - - - True - - - - - - ..\..\packages\dotNetRDF\lib\net40\dotNetRDF.dll - True - True - - - - - - - - - ..\..\packages\FluentAssertions\lib\net45\FluentAssertions.dll - True - True - - - ..\..\packages\FluentAssertions\lib\net45\FluentAssertions.Core.dll - True - True - - - - - - - - - ..\..\packages\HtmlAgilityPack\lib\Net45\HtmlAgilityPack.dll - True - True - - - - - - - - - ..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll - True - True - - - - - - - - - ..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll - True - True - - - - - - - - - ..\..\packages\Nancy\lib\net452\Nancy.dll - True - True - - - - - - - - - ..\..\packages\Nancy.Authentication.Forms\lib\net452\Nancy.Authentication.Forms.dll - True - True - - - - - - - - - ..\..\packages\Nancy.Rdf\lib\net452\Nancy.Rdf.dll - True - True - - - - - - - - - ..\..\packages\Nancy.Testing\lib\net452\Nancy.Testing.dll - True - True - - - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\packages\Rdf.Vocabularies\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Rdf.Vocabularies.dll - True - True - - - - - - - - True - - - True - + + + + + + - - - - - ..\..\packages\System.Runtime.InteropServices.RuntimeInformation\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - True - True - - - - - - - - - ..\..\packages\VDS.Common\lib\net40-client\VDS.Common.dll - True - True - - - - - - - - - ..\..\packages\xunit.abstractions\lib\net35\xunit.abstractions.dll - True - True - - - - - - True - + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - ..\..\packages\xunit.assert\lib\netstandard1.1\xunit.assert.dll - True - True - - - - - - - - - ..\..\packages\xunit.extensibility.core\lib\netstandard1.1\xunit.core.dll - True - True - - - - - - - - - ..\..\packages\xunit.extensibility.execution\lib\net452\xunit.execution.desktop.dll - True - True - - - - - - - ..\..\packages\xunit.extensibility.execution\lib\netstandard1.1\xunit.execution.dotnet.dll - True - True - - - - - \ No newline at end of file diff --git a/src/Argolis.Tests.Integration/FodyWeavers.xml b/src/Argolis.Tests.Integration/FodyWeavers.xml new file mode 100644 index 0000000..12e0515 --- /dev/null +++ b/src/Argolis.Tests.Integration/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/Argolis.Tests.Integration/FodyWeavers.xsd b/src/Argolis.Tests.Integration/FodyWeavers.xsd new file mode 100644 index 0000000..f4d1bb6 --- /dev/null +++ b/src/Argolis.Tests.Integration/FodyWeavers.xsd @@ -0,0 +1,63 @@ + + + + + + + + + + + Used to control whether asserts are added into debug builds or not. + + + + + The operation mode of NullGuard. + + + + + + Automatically detect the mode by the usage of JetBrains.Annotations. + + + + + In implicit mode everything is assumed to be not-null, unless attributed with [AllowNull]. + + + + + In explicit mode everything is assumed to be nullable, unless attributed with [NotNull]. + + + + + + + + A regular expression to specify the names of a classes to exclude from NullGuard. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/src/Argolis.Tests.Integration/IntegrationTests.cs b/src/Argolis.Tests.Integration/IntegrationTests.cs index bfc1ce4..44ae06d 100644 --- a/src/Argolis.Tests.Integration/IntegrationTests.cs +++ b/src/Argolis.Tests.Integration/IntegrationTests.cs @@ -1,12 +1,12 @@ using System; +using System.Net; +using System.Net.Http; using System.Threading.Tasks; using Argolis.Hydra.Core; using FluentAssertions; -using Nancy; -using Nancy.Responses.Negotiation; -using Nancy.Testing; +using Microsoft.AspNetCore.Mvc.Testing; using Newtonsoft.Json; -using TestNancyApp.Bootstrap; +using TestHydraApp; using VDS.RDF; using VDS.RDF.Parsing; using VDS.RDF.Query.Builder; @@ -18,11 +18,14 @@ namespace Argolis.Tests.Integration public class IntegrationTests { private const string ExpectedApiDocPath = "http://hydra.guru/api"; - private readonly Browser browser; + private readonly HttpClient browser; public IntegrationTests() { - this.browser = new Browser(new Bootstrapper(), context => context.HostName("hydra.guru")); + this.browser = new WebApplicationFactory().CreateClient(new WebApplicationFactoryClientOptions + { + BaseAddress = new Uri("http://hydra.guru") + }); } [Fact] @@ -31,6 +34,8 @@ public async Task Should_include_supported_class_in_documentation_response() // when var documentation = await this.GetDocumentationGraph(); + Console.WriteLine(documentation.Triples.Count); + // then var query = QueryBuilder.Ask() .Where(tpb => tpb.Subject("doc").PredicateUri(new Uri(Rdf.type)).Object(new Uri(Vocab.Hydra.ApiDocumentation))) @@ -156,10 +161,16 @@ public async Task Should_include_hydra_base_types_as_supported_classes(string ex public async Task Should_serve_API_doc_with_correct_Id() { // when - var response = await this.browser.Get("api", context => context.Accept(new MediaRange("application/json"))); + var response = await this.browser.SendAsync(new HttpRequestMessage(HttpMethod.Get, "api") + { + Headers = + { + { "Accept", "application/json" } + } + }); // then - var asString = response.Body.AsString(); + var asString = await response.Content.ReadAsStringAsync(); dynamic apiDoc = JsonConvert.DeserializeObject(asString); ((string)apiDoc.id).Should().Be(ExpectedApiDocPath); @@ -194,11 +205,17 @@ public async Task Should_not_contain_duplicate_operations() private async Task GetDocumentationGraph() { - var response = await this.browser.Get("api", context => { context.Accept("text/turtle"); }); + var response = await this.browser.SendAsync(new HttpRequestMessage(HttpMethod.Get, "api") + { + Headers = + { + { "Accept", "text/turtle" } + } + }); response.StatusCode.Should().Be(HttpStatusCode.OK); - return response.Body.AsRdf(); + return (await response.Content.ReadAsStreamAsync()).AsRdf(); } } } \ No newline at end of file diff --git a/src/Argolis.Tests.Integration/Properties/AssemblyInfo.cs b/src/Argolis.Tests.Integration/Properties/AssemblyInfo.cs index 20615de..c14dab4 100644 --- a/src/Argolis.Tests.Integration/Properties/AssemblyInfo.cs +++ b/src/Argolis.Tests.Integration/Properties/AssemblyInfo.cs @@ -2,4 +2,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("Hydra hypermedia integration test")] -[assembly: Guid("41f8c2f5-8b83-430b-9afe-21dcfd84af54")] \ No newline at end of file +[assembly: Guid("41f8c2f5-8b83-430b-9afe-21dcfd84af54")] +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyInformationalVersion("0.3.0-net-standard.1+17.Branch.net-standard.Sha.135579857255b4ca1996cbd6ed4ed93bcbe122fd")] diff --git a/src/Argolis.Tests.Integration/Properties/launchSettings.json b/src/Argolis.Tests.Integration/Properties/launchSettings.json new file mode 100644 index 0000000..1172622 --- /dev/null +++ b/src/Argolis.Tests.Integration/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "Argolis.Tests.Integration": { + "commandName": "Executable", + "executablePath": "dotnet", + "commandLineArgs": "test" + } + } +} \ No newline at end of file diff --git a/src/Argolis.Tests.Integration/TestExtension.cs b/src/Argolis.Tests.Integration/TestExtension.cs index 5c533ec..d31dafe 100644 --- a/src/Argolis.Tests.Integration/TestExtension.cs +++ b/src/Argolis.Tests.Integration/TestExtension.cs @@ -2,7 +2,6 @@ using System.IO; using FluentAssertions; using FluentAssertions.Primitives; -using Nancy.Testing; using VDS.RDF; using VDS.RDF.Query; using VDS.RDF.Query.Datasets; @@ -13,13 +12,13 @@ namespace Argolis.Tests.Integration { public static class TestExtension { - public static IGraph AsRdf(this BrowserResponseBodyWrapper body) + public static IGraph AsRdf(this Stream body) { IGraph graph = new Graph(); graph.NamespaceMap.AddNamespace("hydra", new Uri(Vocab.Hydra.BaseUri)); graph.NamespaceMap.AddNamespace("ex", new Uri("http://example.api/o#")); - using (var reader = new StreamReader(body.AsStream())) + using (var reader = new StreamReader(body)) { new VDS.RDF.Parsing.TurtleParser().Load(graph, reader); } @@ -41,7 +40,7 @@ public GraphAssertions(IGraph graph) this.graph = graph; } - protected override string Context + protected override string Identifier { get { return "Graph"; } } diff --git a/src/Argolis.Tests.Integration/app.config b/src/Argolis.Tests.Integration/app.config deleted file mode 100644 index 843ce66..0000000 --- a/src/Argolis.Tests.Integration/app.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - True - - - - - True - - - - - True - - - - diff --git a/src/Argolis.Tests.Integration/paket.references b/src/Argolis.Tests.Integration/paket.references deleted file mode 100644 index 9c8b420..0000000 --- a/src/Argolis.Tests.Integration/paket.references +++ /dev/null @@ -1,10 +0,0 @@ -GitVersionTask -xunit -fluentassertions -Nancy.Testing -Rdf.Vocabularies -dotnetrdf -json-ld.net -nancy.rdf -StyleCop.Analyzers -tpluscode.UnitTests.Ruleset \ No newline at end of file diff --git a/src/Argolis.Tests/ApiDocumentation/DefaultSupportedOperationFactoryTests.cs b/src/Argolis.Tests/ApiDocumentation/DefaultSupportedOperationFactoryTests.cs index 728f1e8..f75201b 100644 --- a/src/Argolis.Tests/ApiDocumentation/DefaultSupportedOperationFactoryTests.cs +++ b/src/Argolis.Tests/ApiDocumentation/DefaultSupportedOperationFactoryTests.cs @@ -148,7 +148,7 @@ public void PUT_operation_should_always_expect_model_type() A.CallTo(() => this.operations.Type).Returns(typeof(Issue)); A.CallTo(() => this.operations.GetSupportedClassOperations()).Returns(new[] { - new OperationMeta { Method = HttpMethod.Put, Expects = (IriRef)Foaf.Agent } + new OperationMeta { Method = HttpMethod.Put, Expects = (IriRef)Foaf.Person } }); // when diff --git a/src/Argolis.Tests/ApiDocumentation/SupportedOperationBuilderTests.cs b/src/Argolis.Tests/ApiDocumentation/SupportedOperationBuilderTests.cs index b74f089..d2d444c 100644 --- a/src/Argolis.Tests/ApiDocumentation/SupportedOperationBuilderTests.cs +++ b/src/Argolis.Tests/ApiDocumentation/SupportedOperationBuilderTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Argolis.Hydra.Discovery.SupportedOperations; +using Dynamitey; using FluentAssertions; -using ImpromptuInterface; using JsonLD.Entities; using Vocab; using Xunit; @@ -28,7 +28,7 @@ public SupportedOperationBuilderTests() public void Should_store_operation_meta_with_correct_method(string operationMethodName, string expectedMethod) { // when - Impromptu.InvokeMember(this.builder, operationMethodName); + Dynamic.InvokeMember(this.builder, operationMethodName); // then this.operations.Should().Contain(meta => meta.Method == expectedMethod); diff --git a/src/Argolis.Tests/Argolis.Tests.csproj b/src/Argolis.Tests/Argolis.Tests.csproj index 20b25e2..b7ed9ba 100644 --- a/src/Argolis.Tests/Argolis.Tests.csproj +++ b/src/Argolis.Tests/Argolis.Tests.csproj @@ -1,455 +1,53 @@  - - - - + - Debug - AnyCPU - {1167173B-16E1-4A0E-80D6-60A3E600E955} - Library - Properties Argolis.Tests Argolis.Tests - v4.5.2 - 512 - + netcoreapp2.0 + false + false + false + false + false + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - Designer - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {6AC20D75-35CF-4385-912E-BC7E381AD3A0} - Argolis.Models.TunnelVisionLabs - - - {3FADEBA7-BEA0-4864-B3FD-C17EAC737B35} - Argolis.Models - - - {4EC11162-751B-4E73-A3C6-435BD7CAE9BA} - Argolis.Nancy - - - {378ae219-5cef-41ed-839a-1e8343754056} - TestHydraApi - - - {1D2E686F-381D-4700-B062-67AC029C0DAF} - TestNancyApp - - - {CBCAC4DC-129D-4F36-96D5-19B14F18CF18} - Argolis.Hydra.Nancy - - - {F8B427F1-AEEB-481B-8D51-A53AF4EF0813} - Argolis.Hydra - - - - - Designer - - - - - - - <__paket__GitVersionTask_targets>portable-net+sl+win+wpa+wp\GitVersionTask - - - - - - - <__paket__Fody_targets>net452\Fody - - - - - <__paket__Fody_targets>netstandard1.2\Fody - - - - - <__paket__Fody_targets>portable-net+sl+win+wpa+wp\Fody - - - - - - - - - ..\..\packages\AngleSharp\lib\net45\AngleSharp.dll - True - True - - - - - - - True - - - - - - - ..\..\packages\dotNetRDF\lib\net40\dotNetRDF.dll - True - True - - - - - - - - - ..\..\packages\FakeItEasy\lib\net45\FakeItEasy.dll - True - True - - - - - - - - - ..\..\packages\FluentAssertions\lib\net45\FluentAssertions.dll - True - True - - - ..\..\packages\FluentAssertions\lib\net45\FluentAssertions.Core.dll - True - True - - - - - - - - - ..\..\packages\HtmlAgilityPack\lib\Net45\HtmlAgilityPack.dll - True - True - - - - - - - - - ..\..\packages\ImpromptuInterface\lib\net40\ImpromptuInterface.dll - True - True - - - - - - - - - ..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll - True - True - - - - - - - - - ..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll - True - True - - - - - - - - - ..\..\packages\Nancy\lib\net452\Nancy.dll - True - True - - - - - - - - - ..\..\packages\Nancy.Authentication.Forms\lib\net452\Nancy.Authentication.Forms.dll - True - True - - - - - - - - - ..\..\packages\Nancy.Routing.UriTemplates\lib\net452\Nancy.Routing.UriTemplates.dll - True - True - - - - - - - - - ..\..\packages\Nancy.Testing\lib\net452\Nancy.Testing.dll - True - True - - - - - - - - - ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\packages\NullGuard.Fody\lib\netstandard1.0\NullGuard.dll - True - True - - - - - - - - - ..\..\packages\Rdf.Vocabularies\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Rdf.Vocabularies.dll - True - True - - - - - - - - - ..\..\packages\Resourcer.Fody\lib\net452\Resourcer.dll - True - True - - - - - - - - - - True - - - True - - - - - - ..\..\packages\System.Runtime.InteropServices.RuntimeInformation\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - True - True - - - - - - - - - ..\..\packages\TunnelVisionLabs.Net.UriTemplate\lib\net20\TunnelVisionLabs.Net.UriTemplate.dll - True - True - - - - - - - - - ..\..\packages\UriTemplateString\lib\net45\UriTemplateString.dll - True - True - - - - - - - - - ..\..\packages\VDS.Common\lib\net40-client\VDS.Common.dll - True - True - - - - - - - - - ..\..\packages\xunit.abstractions\lib\net35\xunit.abstractions.dll - True - True - - - - - - True - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + - - - - - ..\..\packages\xunit.assert\lib\netstandard1.1\xunit.assert.dll - True - True - - - - - - - - - ..\..\packages\xunit.extensibility.core\lib\netstandard1.1\xunit.core.dll - True - True - - - - - - - - - ..\..\packages\xunit.extensibility.execution\lib\net452\xunit.execution.desktop.dll - True - True - - - - - - - ..\..\packages\xunit.extensibility.execution\lib\netstandard1.1\xunit.execution.dotnet.dll - True - True - - - - - \ No newline at end of file diff --git a/src/Argolis.Tests/ArgolisModuleTests.cs b/src/Argolis.Tests/ArgolisModuleTests.cs index 2e36ca4..2be22c0 100644 --- a/src/Argolis.Tests/ArgolisModuleTests.cs +++ b/src/Argolis.Tests/ArgolisModuleTests.cs @@ -1,5 +1,5 @@ -using System.Linq; -using System.Threading; +using System; +using System.Linq; using System.Threading.Tasks; using Argolis.Models; using Argolis.Nancy; @@ -11,15 +11,16 @@ namespace Argolis.Tests { public class ArgolisModuleTests { - private const string TestPath = "some/path{?s,p,q,r}"; - private readonly ArgolisModule module; + private const string TestPath = "/some/path{?s,p,q,r}"; + private static readonly Func Action = _ => new object(); + private readonly ArgolisModuleTestable module; public ArgolisModuleTests() { var templates = A.Fake(); A.CallTo(() => templates.GetTemplate(typeof(object))).Returns(TestPath); - this.module = new ArgolisModule(templates); + this.module = new ArgolisModuleTestable(templates); } [Fact] @@ -176,14 +177,22 @@ public void Should_add_async_DELETE_route_with_path_from_identifier_provider() this.module.Routes.Should().HaveCount(1); } - private static object Action(object p) + private static Task AsyncAction(dynamic p) { - return new object(); + return Task.FromResult(new object()); } - private static Task AsyncAction(object p) + private class ArgolisModuleTestable : ArgolisModule { - return Task.FromResult(new object()); + public ArgolisModuleTestable(IModelTemplateProvider provider) + : base(provider) + { + } + + public ArgolisModuleTestable(IModelTemplateProvider provider, string modulePath) + : base(provider, modulePath) + { + } } } } \ No newline at end of file diff --git a/src/Argolis.Tests/FodyWeavers.xml b/src/Argolis.Tests/FodyWeavers.xml index f04f026..bbaff3f 100644 --- a/src/Argolis.Tests/FodyWeavers.xml +++ b/src/Argolis.Tests/FodyWeavers.xml @@ -1,5 +1,5 @@ - - + + - + \ No newline at end of file diff --git a/src/Argolis.Tests/FodyWeavers.xsd b/src/Argolis.Tests/FodyWeavers.xsd new file mode 100644 index 0000000..6b4af76 --- /dev/null +++ b/src/Argolis.Tests/FodyWeavers.xsd @@ -0,0 +1,64 @@ + + + + + + + + + + + + Used to control whether asserts are added into debug builds or not. + + + + + The operation mode of NullGuard. + + + + + + Automatically detect the mode by the usage of JetBrains.Annotations. + + + + + In implicit mode everything is assumed to be not-null, unless attributed with [AllowNull]. + + + + + In explicit mode everything is assumed to be nullable, unless attributed with [NotNull]. + + + + + + + + A regular expression to specify the names of a classes to exclude from NullGuard. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/src/Argolis.Tests/Models/AttributeModelTemplateProviderTests.cs b/src/Argolis.Tests/Models/AttributeModelTemplateProviderTests.cs index ecf7d03..d96618f 100644 --- a/src/Argolis.Tests/Models/AttributeModelTemplateProviderTests.cs +++ b/src/Argolis.Tests/Models/AttributeModelTemplateProviderTests.cs @@ -66,7 +66,7 @@ public void Getting_template_for_Hydra_collection_should_retrieve_it_from_attrib } [Fact] - public void Getting_absoulte_template_should_throw_wen_there_is_no_base_URI() + public void Getting_absoulte_template_should_throw_when_there_is_no_base_URI() { // given var type = typeof(Collection); @@ -82,6 +82,10 @@ public class ModelWithTemplate { } + public class MyClass + { + } + private class FakeBaseUriProvider : IBaseUriProvider { public string BaseResourceUri => "http://example.com/"; diff --git a/src/Argolis.Tests/Models/TunnelVisionLabsUriTemplateExpanderTests.cs b/src/Argolis.Tests/Models/DefaultUriTemplateExpanderTests.cs similarity index 93% rename from src/Argolis.Tests/Models/TunnelVisionLabsUriTemplateExpanderTests.cs rename to src/Argolis.Tests/Models/DefaultUriTemplateExpanderTests.cs index 0611fa8..2c1338b 100644 --- a/src/Argolis.Tests/Models/TunnelVisionLabsUriTemplateExpanderTests.cs +++ b/src/Argolis.Tests/Models/DefaultUriTemplateExpanderTests.cs @@ -1,22 +1,22 @@ using System; using System.Collections.Generic; +using Argolis.Hydra.Models; using Argolis.Models; -using Argolis.Models.TunnelVisionLabs; using FakeItEasy; using FluentAssertions; using Xunit; namespace Argolis.Tests.Models { - public class TunnelVisionLabsUriTemplateExpanderTests + public class DefaultUriTemplateExpanderTests { - private readonly TunnelVisionLabsUriTemplateExpander expander; + private readonly DefaultUriTemplateExpander expander; private readonly IModelTemplateProvider templates; - public TunnelVisionLabsUriTemplateExpanderTests() + public DefaultUriTemplateExpanderTests() { this.templates = A.Fake(options => options.Strict()); - this.expander = new TunnelVisionLabsUriTemplateExpander(this.templates); + this.expander = new DefaultUriTemplateExpander(this.templates); } [Fact] diff --git a/src/Argolis.Tests/Models/TunnelVisionLabsUriTemplateMatcherTests.cs b/src/Argolis.Tests/Models/DefaultUriTemplateMatcherTests.cs similarity index 86% rename from src/Argolis.Tests/Models/TunnelVisionLabsUriTemplateMatcherTests.cs rename to src/Argolis.Tests/Models/DefaultUriTemplateMatcherTests.cs index 4f2381e..1328917 100644 --- a/src/Argolis.Tests/Models/TunnelVisionLabsUriTemplateMatcherTests.cs +++ b/src/Argolis.Tests/Models/DefaultUriTemplateMatcherTests.cs @@ -1,21 +1,21 @@ using System; +using Argolis.Hydra.Models; using Argolis.Models; -using Argolis.Models.TunnelVisionLabs; using FakeItEasy; using FluentAssertions; using Xunit; namespace Argolis.Tests.Models { - public class TunnelVisionLabsUriTemplateMatcherTests + public class DefaultUriTemplateMatcherTests { - private readonly TunnelVisionLabsUriTemplateMatcher matcher; + private readonly DefaultUriTemplateMatcher matcher; private readonly IModelTemplateProvider templates; - public TunnelVisionLabsUriTemplateMatcherTests() + public DefaultUriTemplateMatcherTests() { this.templates = A.Fake(options => options.Strict()); - this.matcher = new TunnelVisionLabsUriTemplateMatcher(this.templates); + this.matcher = new DefaultUriTemplateMatcher(this.templates); } [Fact] diff --git a/src/Argolis.Tests/PartialCollectionViewTests.cs b/src/Argolis.Tests/PartialCollectionViewTests.cs index 4a8a377..a02ea67 100644 --- a/src/Argolis.Tests/PartialCollectionViewTests.cs +++ b/src/Argolis.Tests/PartialCollectionViewTests.cs @@ -3,7 +3,6 @@ using Argolis.Hydra.Resources; using FluentAssertions; using JsonLD.Entities; -using TunnelVisionLabs.Net; using Xunit; namespace Argolis.Tests @@ -38,7 +37,7 @@ public void Should_be_of_correct_type() public void Should_calculate_page_URIs_given_item_count_and_template() { // given - var template = new UriTemplate("/some/collection{?page}"); + var template = new UriTemplate.Core.UriTemplate("/some/collection{?page}"); long totalItems = 86; int page = 5; int pageSize = 10; @@ -59,7 +58,7 @@ public void Should_calculate_page_URIs_given_item_count_and_template() public void Should_calculate_page_URIs_given_last_page() { // given - var template = new UriTemplate("/some/collection{?page}"); + var template = new UriTemplate.Core.UriTemplate("/some/collection{?page}"); long totalItems = 86; int page = 9; int pageSize = 10; @@ -80,7 +79,7 @@ public void Should_calculate_page_URIs_given_last_page() public void Should_calculate_page_URIs_given_first_page() { // given - var template = new UriTemplate("/some/collection{?page}"); + var template = new UriTemplate.Core.UriTemplate("/some/collection{?page}"); long totalItems = 86; int page = 1; int pageSize = 10; @@ -101,7 +100,7 @@ public void Should_calculate_page_URIs_given_first_page() public void Should_allow_filling_template_with_additional_parameters() { // given - var template = new UriTemplate("/some{;subfilter}/collection{/page}{?filter}"); + var template = new UriTemplate.Core.UriTemplate("/some{;subfilter}/collection{/page}{?filter}"); long totalItems = 86; int page = 1; int pageSize = 10; diff --git a/src/Argolis.Tests/Properties/AssemblyInfo.cs b/src/Argolis.Tests/Properties/AssemblyInfo.cs index 189ef1d..b645a57 100644 --- a/src/Argolis.Tests/Properties/AssemblyInfo.cs +++ b/src/Argolis.Tests/Properties/AssemblyInfo.cs @@ -3,3 +3,7 @@ [assembly: AssemblyTitle("Hydra hypermedia library test")] [assembly: Guid("1167173b-16e1-4a0e-80d6-60a3e600e955")] + +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: AssemblyInformationalVersion("0.3.0-net-standard.1+17.Branch.net-standard.Sha.135579857255b4ca1996cbd6ed4ed93bcbe122fd")] diff --git a/src/Argolis.Tests/Resources/PartialCollectionViewTests.cs b/src/Argolis.Tests/Resources/PartialCollectionViewTests.cs index 5fe7bf4..f9af7bd 100644 --- a/src/Argolis.Tests/Resources/PartialCollectionViewTests.cs +++ b/src/Argolis.Tests/Resources/PartialCollectionViewTests.cs @@ -3,7 +3,6 @@ using Argolis.Hydra.Resources; using FluentAssertions; using JsonLD.Entities; -using TunnelVisionLabs.Net; using Xunit; namespace Argolis.Tests.Resources @@ -38,7 +37,7 @@ public void Should_be_of_correct_type() public void Should_calculate_page_URIs_given_item_count_and_template() { // given - var template = new UriTemplate("/some/collection{?page}"); + var template = new UriTemplate.Core.UriTemplate("/some/collection{?page}"); long totalItems = 86; int page = 5; int pageSize = 10; @@ -59,7 +58,7 @@ public void Should_calculate_page_URIs_given_item_count_and_template() public void Should_calculate_page_URIs_given_last_page() { // given - var template = new UriTemplate("/some/collection{?page}"); + var template = new UriTemplate.Core.UriTemplate("/some/collection{?page}"); long totalItems = 86; int page = 9; int pageSize = 10; @@ -80,7 +79,7 @@ public void Should_calculate_page_URIs_given_last_page() public void Should_calculate_page_URIs_given_first_page() { // given - var template = new UriTemplate("/some/collection{?page}"); + var template = new UriTemplate.Core.UriTemplate("/some/collection{?page}"); long totalItems = 86; int page = 1; int pageSize = 10; @@ -101,7 +100,7 @@ public void Should_calculate_page_URIs_given_first_page() public void Should_allow_filling_template_with_additional_parameters() { // given - var template = new UriTemplate("/some{;subfilter}/collection{/page}{?filter}"); + var template = new UriTemplate.Core.UriTemplate("/some{;subfilter}/collection{/page}{?filter}"); long totalItems = 86; int page = 1; int pageSize = 10; diff --git a/src/Argolis.Tests/ServingApiDocumentationTests.cs b/src/Argolis.Tests/ServingApiDocumentationTests.cs index 9515d51..d093955 100644 --- a/src/Argolis.Tests/ServingApiDocumentationTests.cs +++ b/src/Argolis.Tests/ServingApiDocumentationTests.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Threading.Tasks; using Argolis.Hydra; +using Argolis.Hydra.Discovery; using Argolis.Hydra.Discovery.SupportedClasses; using Argolis.Hydra.Discovery.SupportedOperations; using Argolis.Hydra.Nancy; @@ -27,6 +29,7 @@ public ServingApiDocumentationTests() A.CallTo(() => rdfTypeProviderPolicy.Create(A._)) .ReturnsLazily(call => new Uri("http://example.com/class")); + Debugger.Break(); this.browser = new Browser( configurator => { @@ -37,6 +40,7 @@ public ServingApiDocumentationTests() configurator.Dependency(A.Fake()); configurator.Dependency(A.Fake()); configurator.Dependency(A.Fake()); + configurator.Dependency(A.Fake()); configurator.ApplicationStartupTask(); }, context => context.HostName("hydra.guru")); diff --git a/src/Argolis.Tests/TestExtension.cs b/src/Argolis.Tests/TestExtension.cs index 81e1308..6b45346 100644 --- a/src/Argolis.Tests/TestExtension.cs +++ b/src/Argolis.Tests/TestExtension.cs @@ -38,7 +38,7 @@ public GraphAssertions(IGraph graph) this.graph = graph; } - protected override string Context + protected override string Identifier { get { return "Graph"; } } diff --git a/src/Argolis.Tests/app.config b/src/Argolis.Tests/app.config deleted file mode 100644 index 843ce66..0000000 --- a/src/Argolis.Tests/app.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - True - - - - - True - - - - - True - - - - diff --git a/src/Argolis.Tests/paket.references b/src/Argolis.Tests/paket.references deleted file mode 100644 index abee6d6..0000000 --- a/src/Argolis.Tests/paket.references +++ /dev/null @@ -1,17 +0,0 @@ -NullGuard.Fody -GitVersionTask -xunit -fluentassertions -TunnelVisionLabs.Net.UriTemplate -Resourcer.Fody -JsonLd.Entities -Nancy.Testing -Rdf.Vocabularies -dotnetrdf -json-ld.net -fakeiteasy -ImpromptuInterface -StyleCop.Analyzers -tpluscode.UnitTests.Ruleset -UriTemplateString -Nancy.Routing.UriTemplates \ No newline at end of file diff --git a/src/CommonAssemblyInfo.cs b/src/CommonAssemblyInfo.cs index 3e6f184..d0fac91 100644 --- a/src/CommonAssemblyInfo.cs +++ b/src/CommonAssemblyInfo.cs @@ -2,4 +2,4 @@ [assembly: AssemblyCompany("Tomasz Pluskiewicz")] [assembly: AssemblyProduct("Argolis - Hydra hypermedia core libraries")] -[assembly: AssemblyCopyright("Copyright © Tomasz Pluskiewicz 2016")] +[assembly: AssemblyCopyright("Copyright © Tomasz Pluskiewicz 2016-2019")] diff --git a/src/Examples/TestHydraApi/Issue.cs b/src/Examples/TestHydraApi/Issue.cs index d7dea92..fe75679 100644 --- a/src/Examples/TestHydraApi/Issue.cs +++ b/src/Examples/TestHydraApi/Issue.cs @@ -20,13 +20,13 @@ public class Issue : IssueBase private const string IssueType = "http://example.api/o#Issue"; public string Id { get; set; } - + [JsonProperty("titel")] public string Title { get; set; } - + [Required] public string Content { get; set; } - + [Description("The number of people who liked this issue")] public int LikesCount { get; private set; } @@ -40,9 +40,15 @@ public class Issue : IssueBase public UndocumentedClass UndocumentedClassProperty { get; set; } - public string Method() + private static JToken Context { - return null; + get + { + return new JArray( + new AutoContext(new Uri(IssueType)) + .Property(i => i.ProjectId, builder => builder.Type().Id()), + User.Context); + } } [JsonProperty] @@ -51,16 +57,9 @@ private string Type get { return IssueType; } } - private static JToken Context + public string Method() { - get - { - return new JArray( - new AutoContext(new Uri(IssueType)) - .Property(i => i.ProjectId, builder => builder.Type().Id()), - User.Context - ); - } + return null; } } } diff --git a/src/Examples/TestHydraApi/IssueCollection.cs b/src/Examples/TestHydraApi/IssueCollection.cs index fa3fa80..1d6356c 100644 --- a/src/Examples/TestHydraApi/IssueCollection.cs +++ b/src/Examples/TestHydraApi/IssueCollection.cs @@ -7,7 +7,7 @@ namespace TestHydraApi { public class IssueCollection : Collection { - [JsonProperty(Vocab.Hydra.BaseUri + "search")] + [JsonProperty(Vocab.Hydra.search)] public IriTemplate Search { get; set; } } } \ No newline at end of file diff --git a/src/Examples/TestHydraApi/Properties/AssemblyInfo.cs b/src/Examples/TestHydraApi/Properties/AssemblyInfo.cs deleted file mode 100644 index 40bbf74..0000000 --- a/src/Examples/TestHydraApi/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TestHydraApi")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TestHydraApi")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("378ae219-5cef-41ed-839a-1e8343754056")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Examples/TestHydraApi/TestHydraApi.csproj b/src/Examples/TestHydraApi/TestHydraApi.csproj index 226a44c..94cd609 100644 --- a/src/Examples/TestHydraApi/TestHydraApi.csproj +++ b/src/Examples/TestHydraApi/TestHydraApi.csproj @@ -1,119 +1,18 @@  - - + - Debug - AnyCPU - {378AE219-5CEF-41ED-839A-1E8343754056} - Library - Properties - TestHydraApi - TestHydraApi - v4.5.2 - 512 - + netstandard2.0 + false + false + false + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - {F8B427F1-AEEB-481B-8D51-A53AF4EF0813} - Argolis.Hydra - - - {3FADEBA7-BEA0-4864-B3FD-C17EAC737B35} - Argolis.Models - - - + + + + + + - - - - - - - ..\..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll - True - True - - - - - - - - - ..\..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll - True - True - - - - - - - - - ..\..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\..\packages\Rdf.Vocabularies\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Rdf.Vocabularies.dll - True - True - - - - \ No newline at end of file diff --git a/src/Examples/TestHydraApi/UndocumentedClass.cs b/src/Examples/TestHydraApi/UndocumentedClass.cs index 6a85d7f..36ee9be 100644 --- a/src/Examples/TestHydraApi/UndocumentedClass.cs +++ b/src/Examples/TestHydraApi/UndocumentedClass.cs @@ -1,4 +1,4 @@ -using Argolis.Hydra.Annotations; +using Argolis.Hydra.Annotations; namespace TestHydraApi { @@ -18,7 +18,10 @@ public string NoSetter get { return "some test"; } } - public string NoGetter { set {} } + public string NoGetter + { + set { } + } [WriteOnly] public string WriteOnly { get; set; } diff --git a/src/Examples/TestHydraApi/User.cs b/src/Examples/TestHydraApi/User.cs index 5a7e0c4..c7f03db 100644 --- a/src/Examples/TestHydraApi/User.cs +++ b/src/Examples/TestHydraApi/User.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.Serialization; using Argolis.Hydra.Annotations; using JsonLD.Entities.Context; @@ -12,22 +12,7 @@ namespace TestHydraApi public class User { private const string ClassUri = "http://example.api/o#User"; - public string Id { get; set; } - [JsonProperty("firstName")] - public string Name { get; set; } - - public string LastName { get; set; } - - [JsonProperty("with_attribute")] - public string NotInContextWithAttribute { get; set; } - - [JsonIgnore] - public string JsonIgnored { get; set; } - - [IgnoreDataMember] - public string DataMemberIgnored { get; set; } - public static Uri Type { get; set; } public static JObject Context @@ -36,11 +21,26 @@ public static JObject Context { var context = new JObject( "firstName".IsProperty(Foaf.givenName), - "lastName".IsProperty(Foaf.lastName) - ); + "lastName".IsProperty(Foaf.lastName)); return new AutoContext(context, new Uri(ClassUri)); } } + + public string Id { get; set; } + + [JsonProperty("firstName")] + public string Name { get; set; } + + public string LastName { get; set; } + + [JsonProperty("with_attribute")] + public string NotInContextWithAttribute { get; set; } + + [JsonIgnore] + public string JsonIgnored { get; set; } + + [IgnoreDataMember] + public string DataMemberIgnored { get; set; } } } \ No newline at end of file diff --git a/src/Examples/TestHydraApi/paket.references b/src/Examples/TestHydraApi/paket.references deleted file mode 100644 index e7d73fe..0000000 --- a/src/Examples/TestHydraApi/paket.references +++ /dev/null @@ -1,3 +0,0 @@ -Newtonsoft.Json -Rdf.Vocabularies -JsonLd.Entities diff --git a/src/Examples/TestNancyApp/Bootstrap/AuthenticationStartup.cs b/src/Examples/TestHydraApp/Bootstrap/AuthenticationStartup.cs similarity index 82% rename from src/Examples/TestNancyApp/Bootstrap/AuthenticationStartup.cs rename to src/Examples/TestHydraApp/Bootstrap/AuthenticationStartup.cs index b70ca99..3e6bd8e 100644 --- a/src/Examples/TestNancyApp/Bootstrap/AuthenticationStartup.cs +++ b/src/Examples/TestHydraApp/Bootstrap/AuthenticationStartup.cs @@ -1,10 +1,9 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Security.Claims; using Nancy.Authentication.Basic; using Nancy.Bootstrapper; -namespace TestNancyApp.Bootstrap +namespace TestHydraApp.Bootstrap { public class AuthenticationStartup : IApplicationStartup { @@ -30,10 +29,10 @@ public class TestUser : ClaimsPrincipal { public TestUser(string userName) { - UserName = userName; - Claims = new[] + this.UserName = userName; + this.Claims = new[] { - new Claim(ClaimTypes.Name, userName) + new Claim(ClaimTypes.Name, userName), }; } diff --git a/src/Examples/TestNancyApp/Bootstrap/Bootstrapper.cs b/src/Examples/TestHydraApp/Bootstrap/Bootstrapper.cs similarity index 95% rename from src/Examples/TestNancyApp/Bootstrap/Bootstrapper.cs rename to src/Examples/TestHydraApp/Bootstrap/Bootstrapper.cs index 9a0d8fc..0f99662 100644 --- a/src/Examples/TestNancyApp/Bootstrap/Bootstrapper.cs +++ b/src/Examples/TestHydraApp/Bootstrap/Bootstrapper.cs @@ -1,18 +1,23 @@ using System; -using System.Linq; using Nancy; using Nancy.Bootstrapper; using Nancy.Configuration; using Nancy.Routing.UriTemplates; using Nancy.TinyIoc; -namespace TestNancyApp.Bootstrap +namespace TestHydraApp.Bootstrap { public class Bootstrapper : DefaultNancyBootstrapper { - protected override void ConfigureApplicationContainer(TinyIoCContainer container) + protected override Func InternalConfiguration { - // don't call base to disable automatic registration + get + { + return NancyInternalConfiguration.WithOverrides(c => + { + c.RouteResolver = typeof(UriTemplateRouteResolver); + }); + } } public override void Configure(INancyEnvironment environment) @@ -21,22 +26,16 @@ public override void Configure(INancyEnvironment environment) environment.Tracing(true, true); } + protected override void ConfigureApplicationContainer(TinyIoCContainer container) + { + // don't call base to disable automatic registration + } + protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context) { base.RequestStartup(container, pipelines, context); container.Register(new NancyContextWrapper(context)); } - - protected override Func InternalConfiguration - { - get - { - return NancyInternalConfiguration.WithOverrides(c => - { - c.RouteResolver = typeof(UriTemplateRouteResolver); - }); - } - } } } \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Bootstrap/CorsStartup.cs b/src/Examples/TestHydraApp/Bootstrap/CorsStartup.cs similarity index 97% rename from src/Examples/TestNancyApp/Bootstrap/CorsStartup.cs rename to src/Examples/TestHydraApp/Bootstrap/CorsStartup.cs index 9ccf690..99d5a9a 100644 --- a/src/Examples/TestNancyApp/Bootstrap/CorsStartup.cs +++ b/src/Examples/TestHydraApp/Bootstrap/CorsStartup.cs @@ -1,7 +1,7 @@ using Nancy; using Nancy.Bootstrapper; -namespace TestNancyApp.Bootstrap +namespace TestHydraApp.Bootstrap { public class CorsStartup : IApplicationStartup { diff --git a/src/Examples/TestHydraApp/Bootstrap/HydraRegistrations.cs b/src/Examples/TestHydraApp/Bootstrap/HydraRegistrations.cs new file mode 100644 index 0000000..ad62314 --- /dev/null +++ b/src/Examples/TestHydraApp/Bootstrap/HydraRegistrations.cs @@ -0,0 +1,22 @@ +using Argolis.Hydra; +using Argolis.Hydra.Discovery.SupportedOperations; +using Argolis.Models; +using Nancy; +using Nancy.Bootstrapper; +using TestHydraApp.Hydra; + +namespace TestHydraApp.Bootstrap +{ + public class HydraRegistrations : Registrations + { + public HydraRegistrations(ITypeCatalog catalog) + : base(catalog) + { + this.Register(new HydraDocumentationSettings()); + + // todo: move to Lernaean.Hydra.Nancy when bug NancyFx/Nancy#2384 is fixed + this.RegisterAll(Lifetime.PerRequest); + this.Register(new BaseProvider()); + } + } +} \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Bootstrap/NancyContextWrapper.cs b/src/Examples/TestHydraApp/Bootstrap/NancyContextWrapper.cs similarity index 67% rename from src/Examples/TestNancyApp/Bootstrap/NancyContextWrapper.cs rename to src/Examples/TestHydraApp/Bootstrap/NancyContextWrapper.cs index 9323a26..ec96de9 100644 --- a/src/Examples/TestNancyApp/Bootstrap/NancyContextWrapper.cs +++ b/src/Examples/TestHydraApp/Bootstrap/NancyContextWrapper.cs @@ -1,14 +1,14 @@ -using Nancy; +using Nancy; -namespace TestNancyApp.Bootstrap +namespace TestHydraApp.Bootstrap { public class NancyContextWrapper { - public NancyContext Context { get; } - public NancyContextWrapper(NancyContext context) { - Context = context; + this.Context = context; } + + public NancyContext Context { get; } } } diff --git a/src/Examples/TestHydraApp/FodyWeavers.xml b/src/Examples/TestHydraApp/FodyWeavers.xml new file mode 100644 index 0000000..12e0515 --- /dev/null +++ b/src/Examples/TestHydraApp/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/Examples/TestHydraApp/FodyWeavers.xsd b/src/Examples/TestHydraApp/FodyWeavers.xsd new file mode 100644 index 0000000..f4d1bb6 --- /dev/null +++ b/src/Examples/TestHydraApp/FodyWeavers.xsd @@ -0,0 +1,63 @@ + + + + + + + + + + + Used to control whether asserts are added into debug builds or not. + + + + + The operation mode of NullGuard. + + + + + + Automatically detect the mode by the usage of JetBrains.Annotations. + + + + + In implicit mode everything is assumed to be not-null, unless attributed with [AllowNull]. + + + + + In explicit mode everything is assumed to be nullable, unless attributed with [NotNull]. + + + + + + + + A regular expression to specify the names of a classes to exclude from NullGuard. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Hydra/AssembliesToScanForSupportedTypes.cs b/src/Examples/TestHydraApp/Hydra/AssembliesToScanForSupportedTypes.cs similarity index 68% rename from src/Examples/TestNancyApp/Hydra/AssembliesToScanForSupportedTypes.cs rename to src/Examples/TestHydraApp/Hydra/AssembliesToScanForSupportedTypes.cs index 3a6fc61..4eebfe8 100644 --- a/src/Examples/TestNancyApp/Hydra/AssembliesToScanForSupportedTypes.cs +++ b/src/Examples/TestHydraApp/Hydra/AssembliesToScanForSupportedTypes.cs @@ -1,15 +1,15 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Reflection; using Argolis.Hydra.Discovery.SupportedClasses; using TestHydraApi; -namespace TestNancyApp.Hydra +namespace TestHydraApp.Hydra { public class AssembliesToScanForSupportedTypes : AssemblyAnnotatedTypeSelector { protected override IEnumerable Assemblies { - get { yield return typeof (Issue).Assembly; } + get { yield return typeof(Issue).Assembly; } } } } \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Hydra/BaseProvider.cs b/src/Examples/TestHydraApp/Hydra/BaseProvider.cs similarity index 83% rename from src/Examples/TestNancyApp/Hydra/BaseProvider.cs rename to src/Examples/TestHydraApp/Hydra/BaseProvider.cs index b119c84..bdb1876 100644 --- a/src/Examples/TestNancyApp/Hydra/BaseProvider.cs +++ b/src/Examples/TestHydraApp/Hydra/BaseProvider.cs @@ -1,6 +1,6 @@ using Argolis.Models; -namespace TestNancyApp.Hydra +namespace TestHydraApp.Hydra { public class BaseProvider : IBaseUriProvider { diff --git a/src/Examples/TestNancyApp/Hydra/HydraDocumentationSettings.cs b/src/Examples/TestHydraApp/Hydra/HydraDocumentationSettings.cs similarity index 92% rename from src/Examples/TestNancyApp/Hydra/HydraDocumentationSettings.cs rename to src/Examples/TestHydraApp/Hydra/HydraDocumentationSettings.cs index 5984cf8..142f7e1 100644 --- a/src/Examples/TestNancyApp/Hydra/HydraDocumentationSettings.cs +++ b/src/Examples/TestHydraApp/Hydra/HydraDocumentationSettings.cs @@ -1,7 +1,7 @@ using Argolis.Hydra; using JsonLD.Entities; -namespace TestNancyApp.Hydra +namespace TestHydraApp.Hydra { public class HydraDocumentationSettings : IHydraDocumentationSettings { diff --git a/src/Examples/TestNancyApp/Hydra/IssueSupportedOperations.cs b/src/Examples/TestHydraApp/Hydra/IssueSupportedOperations.cs similarity index 52% rename from src/Examples/TestNancyApp/Hydra/IssueSupportedOperations.cs rename to src/Examples/TestHydraApp/Hydra/IssueSupportedOperations.cs index 2411f88..de6980b 100644 --- a/src/Examples/TestNancyApp/Hydra/IssueSupportedOperations.cs +++ b/src/Examples/TestHydraApp/Hydra/IssueSupportedOperations.cs @@ -1,21 +1,21 @@ -using Argolis.Hydra.Discovery.SupportedOperations; +using Argolis.Hydra.Discovery.SupportedOperations; using TestHydraApi; -using TestNancyApp.Bootstrap; +using TestHydraApp.Bootstrap; -namespace TestNancyApp.Hydra +namespace TestHydraApp.Hydra { public class IssueSupportedOperations : SupportedOperations { public IssueSupportedOperations(NancyContextWrapper current) { - Class.SupportsGet(); + this.Class.SupportsGet(); if (current.Context.CurrentUser?.IsInRole("Admin") == true) { - Class.SupportsDelete(); + this.Class.SupportsDelete(); } - Property(issue => issue.ProjectId).SupportsGet(); + this.Property(issue => issue.ProjectId).SupportsGet(); } } } \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Hydra/UserSupportedOperations.cs b/src/Examples/TestHydraApp/Hydra/UserSupportedOperations.cs similarity index 57% rename from src/Examples/TestNancyApp/Hydra/UserSupportedOperations.cs rename to src/Examples/TestHydraApp/Hydra/UserSupportedOperations.cs index 6cfd6c3..fac1d95 100644 --- a/src/Examples/TestNancyApp/Hydra/UserSupportedOperations.cs +++ b/src/Examples/TestHydraApp/Hydra/UserSupportedOperations.cs @@ -1,13 +1,13 @@ -using Argolis.Hydra.Discovery.SupportedOperations; +using Argolis.Hydra.Discovery.SupportedOperations; using TestHydraApi; -namespace TestNancyApp.Hydra +namespace TestHydraApp.Hydra { public class UserSupportedOperations : SupportedOperations { public UserSupportedOperations() { - Class.SupportsGet(); + this.Class.SupportsGet(); } } } \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Modules/IssuesModule.cs b/src/Examples/TestHydraApp/Modules/IssuesModule.cs similarity index 75% rename from src/Examples/TestNancyApp/Modules/IssuesModule.cs rename to src/Examples/TestHydraApp/Modules/IssuesModule.cs index 6865329..8fd0b15 100644 --- a/src/Examples/TestNancyApp/Modules/IssuesModule.cs +++ b/src/Examples/TestHydraApp/Modules/IssuesModule.cs @@ -5,10 +5,10 @@ using Argolis.Models; using Argolis.Nancy; using JsonLD.Entities; -using TestHydraApi; using Nancy.ModelBinding; +using TestHydraApi; -namespace TestNancyApp.Modules +namespace TestHydraApp.Modules { public sealed class IssuesModule : ArgolisModule { @@ -18,20 +18,20 @@ public IssuesModule(IIriTemplateFactory templateFactory, IModelTemplateProvider : base(provider) { this.templateFactory = templateFactory; - using (Templates) + using (this.Templates) { - Get(_ => new Issue + this.Get(_ => new Issue { - Id = Request.Url, + Id = this.Request.Url, Content = "This Hydra library is not yet complete", DateCreated = new DateTime(2016, 3, 21), IsResolved = _.id % 2 == 0, - ProjectId = (IriRef) "/project/argolis", - Submitter = new User {Name = "Tomasz", LastName = "Pluskiewicz"}, + ProjectId = (IriRef)"/project/argolis", + Submitter = new User { Name = "Tomasz", LastName = "Pluskiewicz" }, Title = "Complete implementation" }); - Get>(_ => StubCollection(this.Bind())); + this.Get>(_ => this.StubCollection(this.Bind())); } } @@ -43,12 +43,12 @@ private Collection StubCollection(IssueFilter filter) { Title = $"{filter.Title} issue #{i}", DateCreated = new DateTime(filter.Year ?? random.Next(2000, DateTime.Now.Year), random.Next(1, 12), random.Next(1, 29)), - ProjectId = (IriRef) "/ęś" + ProjectId = (IriRef)"/ęś" }); return new IssueCollection { - Id = Request.Url, + Id = this.Request.Url, Members = members.ToArray(), TotalItems = 10, Search = this.templateFactory.CreateIriTemplate() diff --git a/src/Examples/TestHydraApp/Program.cs b/src/Examples/TestHydraApp/Program.cs new file mode 100644 index 0000000..87b0729 --- /dev/null +++ b/src/Examples/TestHydraApp/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace TestHydraApp +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/src/Examples/TestHydraApp/Properties/launchSettings.json b/src/Examples/TestHydraApp/Properties/launchSettings.json new file mode 100644 index 0000000..1c1b5f4 --- /dev/null +++ b/src/Examples/TestHydraApp/Properties/launchSettings.json @@ -0,0 +1,26 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:26813", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "TestHydraApp": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:5000" + } + } +} \ No newline at end of file diff --git a/src/Examples/TestHydraApp/Startup.cs b/src/Examples/TestHydraApp/Startup.cs new file mode 100644 index 0000000..3377efd --- /dev/null +++ b/src/Examples/TestHydraApp/Startup.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Nancy.Owin; + +namespace TestHydraApp +{ + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + app.UseOwin(owin => owin.UseNancy()); + } + } +} diff --git a/src/Examples/TestHydraApp/TestHydraApp.csproj b/src/Examples/TestHydraApp/TestHydraApp.csproj new file mode 100644 index 0000000..24d7012 --- /dev/null +++ b/src/Examples/TestHydraApp/TestHydraApp.csproj @@ -0,0 +1,57 @@ + + + + netcoreapp2.0 + false + false + false + true + NU1605 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Bootstrap/HydraRegistrations.cs b/src/Examples/TestNancyApp/Bootstrap/HydraRegistrations.cs deleted file mode 100644 index cb664b9..0000000 --- a/src/Examples/TestNancyApp/Bootstrap/HydraRegistrations.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Argolis.Hydra; -using Argolis.Hydra.Discovery.SupportedOperations; -using Argolis.Models; -using Argolis.Models.TunnelVisionLabs; -using Nancy; -using Nancy.Bootstrapper; -using TestNancyApp.Hydra; -using TestNancyApp.Modules; - -namespace TestNancyApp.Bootstrap -{ - public class HydraRegistrations : Registrations - { - public HydraRegistrations(ITypeCatalog catalog) - : base(catalog) - { - Register(new HydraDocumentationSettings()); - - // todo: move to Lernaean.Hydra.Nancy when bug NancyFx/Nancy#2384 is fixed - RegisterAll(Lifetime.PerRequest); - Register(new BaseProvider()); - - Register(typeof(TunnelVisionLabsUriTemplateExpander)); - Register(typeof(TunnelVisionLabsUriTemplateMatcher)); - } - } -} \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Properties/AssemblyInfo.cs b/src/Examples/TestNancyApp/Properties/AssemblyInfo.cs deleted file mode 100644 index a5bf3ad..0000000 --- a/src/Examples/TestNancyApp/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("TestNancyApp")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TestNancyApp")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1d2e686f-381d-4700-b062-67ac029c0daf")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Examples/TestNancyApp/Startup.cs b/src/Examples/TestNancyApp/Startup.cs deleted file mode 100644 index 7eb4114..0000000 --- a/src/Examples/TestNancyApp/Startup.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.Owin; -using Owin; -using TestNancyApp; - -[assembly: OwinStartup(typeof(Startup))] - -namespace TestNancyApp -{ - public class Startup - { - public void Configuration(IAppBuilder app) - { - app.UseNancy(); - } - } -} \ No newline at end of file diff --git a/src/Examples/TestNancyApp/TestNancyApp.csproj b/src/Examples/TestNancyApp/TestNancyApp.csproj deleted file mode 100644 index 3b7ed06..0000000 --- a/src/Examples/TestNancyApp/TestNancyApp.csproj +++ /dev/null @@ -1,347 +0,0 @@ - - - - - Debug - AnyCPU - - - 2.0 - {1D2E686F-381D-4700-B062-67AC029C0DAF} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - TestNancyApp - TestNancyApp - v4.5.2 - true - - - - - - - - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - - - - - - - - - - - - - - - - {cbcac4dc-129d-4f36-96d5-19b14f18cf18} - Argolis.Hydra.Nancy - - - {F8B427F1-AEEB-481B-8D51-A53AF4EF0813} - Argolis.Hydra - - - {6ac20d75-35cf-4385-912e-bc7e381ad3a0} - Argolis.Models.TunnelVisionLabs - - - {3FADEBA7-BEA0-4864-B3FD-C17EAC737B35} - Argolis.Models - - - {4EC11162-751B-4E73-A3C6-435BD7CAE9BA} - Argolis.Nancy - - - {378ae219-5cef-41ed-839a-1e8343754056} - TestHydraApi - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 61186 - / - http://localhost:61186/ - False - False - - - False - - - - - - - - True - - - - - - - ..\..\..\packages\dotNetRDF\lib\net40\dotNetRDF.dll - True - True - - - - - - - - - ..\..\..\packages\HtmlAgilityPack\lib\Net45\HtmlAgilityPack.dll - True - True - - - - - - - - - ..\..\..\packages\json-ld.net\lib\net40-client\json-ld.net.dll - True - True - - - - - - - - - ..\..\..\packages\JsonLd.Entities\lib\net40\JsonLD.Entities.dll - True - True - - - - - - - - - ..\..\..\packages\Microsoft.Owin\lib\net45\Microsoft.Owin.dll - True - True - - - - - - - - - ..\..\..\packages\Microsoft.Owin.Host.SystemWeb\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - True - True - - - - - - - - - ..\..\..\packages\Microsoft.Owin.Hosting\lib\net45\Microsoft.Owin.Hosting.dll - True - True - - - - - - - - - ..\..\..\packages\Nancy\lib\net452\Nancy.dll - True - True - - - - - - - - - ..\..\..\packages\Nancy.Authentication.Basic\lib\net452\Nancy.Authentication.Basic.dll - True - True - - - - - - - - - ..\..\..\packages\Nancy.Owin\lib\net452\Nancy.Owin.dll - True - True - - - - - - - - - ..\..\..\packages\Nancy.Rdf\lib\net452\Nancy.Rdf.dll - True - True - - - - - - - - - ..\..\..\packages\Nancy.Routing.UriTemplates\lib\net452\Nancy.Routing.UriTemplates.dll - True - True - - - - - - - - - ..\..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll - True - True - - - - - - - - - ..\..\..\packages\Owin\lib\net40\Owin.dll - True - True - - - - - - - - - ..\..\..\packages\Rdf.Vocabularies\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\Rdf.Vocabularies.dll - True - True - - - - - - - - - ..\..\..\packages\TunnelVisionLabs.Net.UriTemplate\lib\net20\TunnelVisionLabs.Net.UriTemplate.dll - True - True - - - - - - - - - ..\..\..\packages\UriTemplateString\lib\net45\UriTemplateString.dll - True - True - - - - - - - - - ..\..\..\packages\VDS.Common\lib\net40-client\VDS.Common.dll - True - True - - - - - \ No newline at end of file diff --git a/src/Examples/TestNancyApp/Web.config b/src/Examples/TestNancyApp/Web.config deleted file mode 100644 index dc89191..0000000 --- a/src/Examples/TestNancyApp/Web.config +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - True - - - - - True - - - - \ No newline at end of file diff --git a/src/Examples/TestNancyApp/paket.references b/src/Examples/TestNancyApp/paket.references deleted file mode 100644 index 6e6743d..0000000 --- a/src/Examples/TestNancyApp/paket.references +++ /dev/null @@ -1,8 +0,0 @@ -Nancy.Owin -Microsoft.Owin.Host.SystemWeb -Microsoft.Owin.Hosting -JsonLD.Entities -nancy.rdf -Nancy.Authentication.Basic -Nancy.Routing.UriTemplates -uritemplatestring \ No newline at end of file