finish up tests

This commit is contained in:
Tommy Parnell
2016-11-08 23:20:57 -05:00
parent 2885118175
commit c66614c2fe
3 changed files with 8 additions and 10 deletions

View File

@@ -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!

View File

@@ -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]

View File

@@ -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;
} }