-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from AdrianJSClark/replace-webutilities-package
Replace Web Utilities Package
- Loading branch information
Showing
5 changed files
with
278 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Aydsko.iRacingData.UnitTests; | ||
|
||
internal sealed class UrlExtensionsTests | ||
{ | ||
[Test, TestCaseSource(nameof(ValidateToUrlWithQueryMethodTestCases))] | ||
public Uri ValidateToUrlWithQueryMethod(string url, IEnumerable<KeyValuePair<string, object?>> parameters) | ||
{ | ||
return url.ToUrlWithQuery(parameters); | ||
} | ||
|
||
private static IEnumerable<TestCaseData> ValidateToUrlWithQueryMethodTestCases() | ||
{ | ||
yield return new TestCaseData("https://example.com", Array.Empty<KeyValuePair<string, object?>>()) { ExpectedResult = new Uri("https://example.com") }; | ||
yield return new TestCaseData("https://example.com", new KeyValuePair<string, object?>[] { new("foo", "bar" ) }) { ExpectedResult = new Uri("https://example.com?foo=bar") }; | ||
#pragma warning disable CA1861 // Avoid constant arrays as arguments | ||
yield return new TestCaseData("https://example.com", new KeyValuePair<string, object?>[] { new("foo", new[] { "bar", "baz" } ) }) { ExpectedResult = new Uri("https://example.com?foo=bar,baz") }; | ||
#pragma warning restore CA1861 // Avoid constant arrays as arguments | ||
yield return new TestCaseData("https://example.com", new KeyValuePair<string, object?>[] { new("=&?", "=?&=?&" ) }) { ExpectedResult = new Uri("https://example.com?%3D%26%3F=%3D%3F%26%3D%3F%26") }; | ||
yield return new TestCaseData("https://example.com", new KeyValuePair<string, object?>[] { new("foo", "bar" ), new("baz", "bat" ) }) { ExpectedResult = new Uri("https://example.com?foo=bar&baz=bat") }; | ||
yield return new TestCaseData("https://example.com?a=b", new KeyValuePair<string, object?>[] { new("foo", "bar" ), new("baz", "bat" ) }) { ExpectedResult = new Uri("https://example.com?a=b&foo=bar&baz=bat") }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.