Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91579a1700 | ||
|
|
d6c78f2193 | ||
|
|
dbb9f5b404 | ||
|
|
5bfe876f57 | ||
|
|
6a31a1968e | ||
|
|
43bcbb3c30 | ||
|
|
c66614c2fe | ||
|
|
2885118175 | ||
|
|
9b5bd3769f | ||
|
|
0b1b20f5df | ||
|
|
a15ad38a86 | ||
|
|
0a14c742e1 | ||
|
|
103bab1eb7 | ||
|
|
e1817ab447 |
@@ -1,3 +1,8 @@
|
|||||||
|
if($env:APPVEYOR_REPO_TAG -eq "true")
|
||||||
|
{
|
||||||
|
"do not publish coverall data on tag builds"
|
||||||
|
return
|
||||||
|
}
|
||||||
nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
|
nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
|
||||||
nuget install coveralls.net -Version 0.7.0 -OutputDirectory tools
|
nuget install coveralls.net -Version 0.7.0 -OutputDirectory tools
|
||||||
|
|
||||||
|
|||||||
11
Readme.md
11
Readme.md
@@ -1,6 +1,7 @@
|
|||||||
## UriBuilder.Fluent
|
## UriBuilder.Fluent
|
||||||
|
[](https://coveralls.io/github/TerribleDev/UriBuilder.Fluent) [](https://ci.appveyor.com/project/tparnell8/uribuilder-fluent/branch/master)
|
||||||
|
|
||||||
This places extension methods over System.UriBuilder to help deal with query string parameters, and create more of a fluent interface. Unlike other projects this builds ontop of trusty UriBuilder, and does not use custom Uri generators, or have outside dependencies.
|
This places extension methods over System.UriBuilder to help deal with query string parameters, and create more of a fluent interface. Unlike other projects, this NetStandardLibrary compliant package builds ontop of trusty UriBuilder, does not use custom Uri generators, or have outside dependencies. Unit tests continue to be a first class citizen!
|
||||||
|
|
||||||
This lets you do things like
|
This lets you do things like
|
||||||
|
|
||||||
@@ -28,7 +29,9 @@ new UriBuilder("https://awesome.com/yo)
|
|||||||
.WithParameter("id", "5")
|
.WithParameter("id", "5")
|
||||||
.ToString();
|
.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
result: `https://awesome.com/yo?id=5`
|
result: `https://awesome.com/yo?id=5`
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
Just install the nuget package `install-package UriBuilder.Fluent` and thats it. The extension methods should be available to you!
|
||||||
@@ -4,7 +4,7 @@ nuget:
|
|||||||
account_feed: true
|
account_feed: true
|
||||||
project_feed: true
|
project_feed: true
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: '**\*.nupkg'
|
- path: 'src\**\*.nupkg'
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- git config --global core.autocrlf true
|
- git config --global core.autocrlf true
|
||||||
@@ -17,14 +17,14 @@ build_script:
|
|||||||
- ps: dotnet restore
|
- ps: dotnet restore
|
||||||
- ps: dotnet build -c Release .\src\UriBuilder.Fluent
|
- ps: dotnet build -c Release .\src\UriBuilder.Fluent
|
||||||
- ps: dotnet build -c Release .\src\UriBuilder.Fluent.UnitTests
|
- ps: dotnet build -c Release .\src\UriBuilder.Fluent.UnitTests
|
||||||
- ps: .\update-projectjson.ps1
|
|
||||||
- ps: dotnet restore
|
|
||||||
- ps: dotnet pack -c Release .\src\UriBuilder.Fluent
|
|
||||||
|
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- ps: dotnet test -c Release .\src\UriBuilder.Fluent.UnitTests
|
- ps: dotnet test -c Release .\src\UriBuilder.Fluent.UnitTests
|
||||||
- ps: .\Coverage.ps1
|
- ps: .\Coverage.ps1
|
||||||
|
- ps: .\update-projectjson.ps1
|
||||||
|
- ps: dotnet restore
|
||||||
|
- ps: dotnet pack -c Release .\src\UriBuilder.Fluent
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
- provider: NuGet
|
- provider: NuGet
|
||||||
|
|||||||
@@ -97,6 +97,16 @@ namespace FluentUriBuilder.Tests
|
|||||||
Assert.Equal(url.Host, "yodawg.com");
|
Assert.Equal(url.Host, "yodawg.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AddParamWithNoValue()
|
||||||
|
{
|
||||||
|
var url = new UriBuilder("http://awesome.com")
|
||||||
|
.WithParameter("awesome", "yodawg")
|
||||||
|
.WithParameter("fun", null)
|
||||||
|
.WithParameter("cool", string.Empty);
|
||||||
|
Assert.Equal("http://awesome.com/?awesome=yodawg&fun&cool", url.Uri.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestAddTwoUrlParameters()
|
public void TestAddTwoUrlParameters()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,11 +51,6 @@ namespace System
|
|||||||
throw new ArgumentNullException(nameof(pathSegment));
|
throw new ArgumentNullException(nameof(pathSegment));
|
||||||
}
|
}
|
||||||
var path = pathSegment.TrimStart('/');
|
var path = pathSegment.TrimStart('/');
|
||||||
if(string.IsNullOrWhiteSpace(bld.Path))
|
|
||||||
{
|
|
||||||
bld.Path = path;
|
|
||||||
return bld;
|
|
||||||
}
|
|
||||||
bld.Path = $"{bld.Path.TrimEnd('/')}/{path}";
|
bld.Path = $"{bld.Path.TrimEnd('/')}/{path}";
|
||||||
return bld;
|
return bld;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
"owners": [
|
"owners": [
|
||||||
"Tommy Parnell"
|
"Tommy Parnell"
|
||||||
],
|
],
|
||||||
"repository": {
|
"projectUrl": "https://github.com/TerribleDev/UriBuilder.Fluent",
|
||||||
"url":"https://github.com/TerribleDev/UriBuilder.Fluent"
|
|
||||||
},
|
|
||||||
"summary": "Fluent extensions for UriBuilder",
|
"summary": "Fluent extensions for UriBuilder",
|
||||||
"tags": [
|
"tags": [
|
||||||
"Url building",
|
"Url building",
|
||||||
@@ -19,9 +17,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.6.0"
|
"NETStandard.Library": "1.6.0"
|
||||||
},
|
},
|
||||||
|
"authors": [
|
||||||
|
"Tommy Parnell"
|
||||||
|
],
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netstandard1.3": {
|
"netstandard1.1": {
|
||||||
"imports": "dnxcore50"
|
"imports": "dnxcore50"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user