Compare commits
3 Commits
objectSeri
...
1.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1527c058c | ||
|
|
908d0e2433 | ||
|
|
e9f3e5ed8b |
@@ -6,6 +6,6 @@ if($env:APPVEYOR_REPO_TAG -eq "true")
|
||||
nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
|
||||
nuget install coveralls.net -Version 0.7.0 -OutputDirectory tools
|
||||
|
||||
.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:" test "".\src\UriBuilder.Fluent.UnitTests"" -f net462" -register:user -filter:"+[UriBuilder*]* -[*Tests]*" -returntargetcode -output:opencover_results.xml
|
||||
.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:" test "".\src\UriBuilder.Fluent.UnitTests"" -f net461" -register:user -filter:"+[UriBuilder*]* -[*Tests]*" -returntargetcode -output:opencover_results.xml
|
||||
|
||||
.\tools\coveralls.net.0.7.0\tools\csmacnz.Coveralls.exe --opencover -i .\opencover_results.xml
|
||||
@@ -12,16 +12,15 @@ init:
|
||||
before_build:
|
||||
- ps: invoke-webrequest https://go.microsoft.com/fwlink/?LinkID=827524 -OutFile core.exe
|
||||
- ps: .\core.exe /install /quiet /norestart
|
||||
- ps: iwr -Uri https://download.microsoft.com/download/E/F/D/EFD52638-B804-4865-BB57-47F4B9C80269/NDP462-DevPack-KB3151934-ENU.exe -OutFile net452.exe
|
||||
- ps: start-process .\net452.exe -Wait '/install /quiet /norestart'
|
||||
|
||||
build_script:
|
||||
- ps: dotnet restore
|
||||
- ps: dotnet build -c Release .\src\UriBuilder.Fluent
|
||||
- ps: dotnet publish -c Release .\src\UriBuilder.Fluent.UnitTests
|
||||
- ps: dotnet build -c Release .\src\UriBuilder.Fluent.UnitTests
|
||||
|
||||
|
||||
test_script:
|
||||
- ps: dotnet test -c Release .\src\UriBuilder.Fluent.UnitTests
|
||||
- ps: .\Coverage.ps1
|
||||
- ps: .\update-projectjson.ps1
|
||||
- ps: dotnet restore
|
||||
|
||||
@@ -36,6 +36,17 @@ namespace FluentUriBuilder.Tests
|
||||
Assert.Equal("http://awesome.com/?awesome=yodawg", url.Uri.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PathAndQuery()
|
||||
{
|
||||
var url = new UriBuilder().WithPathSegment("/awesome/v1/").WithParameter("awesome", "cool").PathAndQuery();
|
||||
Assert.Equal("/awesome/v1/?awesome=cool", url);
|
||||
url = new UriBuilder().WithPathSegment("/awesome/v1").WithParameter("awesome", "cool").PathAndQuery();
|
||||
Assert.Equal("/awesome/v1?awesome=cool", url);
|
||||
url = new UriBuilder().WithPathSegment("/awesome/v1").PathAndQuery();
|
||||
Assert.Equal("/awesome/v1", url);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestAddParameterArray()
|
||||
{
|
||||
@@ -116,16 +127,6 @@ namespace FluentUriBuilder.Tests
|
||||
.WithParameter("supgf", "no22");
|
||||
Assert.Equal("http://awesome.com/?awesome=yodawg&supg=no2&supgf=no22", url.Uri.ToString());
|
||||
}
|
||||
[Fact]
|
||||
public void TestSerializedParameters()
|
||||
{
|
||||
var url = new UriBuilder("http://awesome.com")
|
||||
.WithSerializedObject(new {yo="dawg"});
|
||||
Assert.Equal("http://awesome.com/?yo=dawg", url.Uri.ToString());
|
||||
url = new UriBuilder("http://awesome.com")
|
||||
.WithSerializedObject(new {yo=""});
|
||||
Assert.Equal("http://awesome.com/?yo", url.Uri.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddDictOfParams()
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net462": {
|
||||
},
|
||||
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -18,7 +17,6 @@ namespace System
|
||||
/// <returns></returns>
|
||||
public static UriBuilder WithParameter(this UriBuilder bld, string key, params string[] values) => bld.WithParameter(key, valuesEnum: values);
|
||||
|
||||
public static UriBuilder WithParameter(this UriBuilder bld, string key, object value) => bld.WithParameter(key, new object[1] { value });
|
||||
/// <summary>
|
||||
/// Appends query strings from dictionary
|
||||
/// </summary>
|
||||
@@ -129,6 +127,11 @@ namespace System
|
||||
return bld;
|
||||
}
|
||||
|
||||
public static string PathAndQuery(this UriBuilder bld)
|
||||
{
|
||||
return bld.Path + bld.Query;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use Https?
|
||||
/// </summary>
|
||||
@@ -140,20 +143,5 @@ namespace System
|
||||
bld.Scheme = predicate ? "https" : "http";
|
||||
return bld;
|
||||
}
|
||||
|
||||
#if (netstandard15)
|
||||
|
||||
public static UriBuilder WithSerializedObject(this UriBuilder bld, object serialize)
|
||||
{
|
||||
var types = serialize.GetType().GetTypeInfo().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty);
|
||||
foreach(var type in types)
|
||||
{
|
||||
bld.WithParameter(type.Name, type.GetValue(serialize, null));
|
||||
}
|
||||
|
||||
return bld;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,7 @@
|
||||
"owners": [
|
||||
"Tommy Parnell"
|
||||
],
|
||||
"repository": {
|
||||
"url": "https://github.com/TerribleDev/UriBuilder.Fluent"
|
||||
},
|
||||
"projectUrl": "https://github.com/TerribleDev/UriBuilder.Fluent",
|
||||
"summary": "Fluent extensions for UriBuilder",
|
||||
"tags": [
|
||||
"Url building",
|
||||
@@ -21,28 +19,14 @@
|
||||
],
|
||||
"frameworks": {
|
||||
"netstandard1.1": {
|
||||
"buildOptions": {
|
||||
"define": [ "netstandard11" ]
|
||||
},
|
||||
"imports": "dnxcore50",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0"
|
||||
}
|
||||
},
|
||||
"netstandard1.5": {
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.6.0"
|
||||
"net40": {
|
||||
"imports": "dnxcore50"
|
||||
},
|
||||
"buildOptions": {
|
||||
"define": [ "netstandard15" ]
|
||||
}
|
||||
},
|
||||
"net45":{
|
||||
"buildOptions": {
|
||||
"define": [ "netstandard15" ]
|
||||
},
|
||||
"frameworkAssemblies": {
|
||||
"System.Runtime":"4.0.0"
|
||||
}
|
||||
}
|
||||
"net45":{}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user