finish up tests
This commit is contained in:
@@ -29,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 avalbile to you!
|
||||||
@@ -102,8 +102,9 @@ namespace FluentUriBuilder.Tests
|
|||||||
{
|
{
|
||||||
var url = new UriBuilder("http://awesome.com")
|
var url = new UriBuilder("http://awesome.com")
|
||||||
.WithParameter("awesome", "yodawg")
|
.WithParameter("awesome", "yodawg")
|
||||||
.WithParameter("fun", null);
|
.WithParameter("fun", null)
|
||||||
Assert.Equal("http://awesome.com/?awesome=yodawg&fun", url.Uri.ToString());
|
.WithParameter("cool", string.Empty);
|
||||||
|
Assert.Equal("http://awesome.com/?awesome=yodawg&fun&cool", url.Uri.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user