Skip to content

Commit

Permalink
Cleanup tests for handling special characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Koelman committed Dec 3, 2021
1 parent fec1973 commit 5c1648a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Reflection;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Web;
using FluentAssertions;
using FluentAssertions.Extensions;
using Humanizer;
Expand Down Expand Up @@ -208,7 +209,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
await dbContext.SaveChangesAsync();
});

string route = $"/filterableResources?filter=equals(someDateTimeOffset,'{WebUtility.UrlEncode(resource.SomeDateTimeOffset.ToString("O"))}')";
string route = $"/filterableResources?filter=equals(someDateTimeOffset,'{HttpUtility.UrlEncode(resource.SomeDateTimeOffset.ToString("O"))}')";

// Act
(HttpResponseMessage httpResponse, Document responseDocument) = await _testContext.ExecuteGetAsync<Document>(route);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task Can_filter_equality_on_special_characters()
// Arrange
var resource = new FilterableResource
{
SomeString = "This, that & more"
SomeString = "This, that & more + some"
};

await _testContext.RunOnDatabaseAsync(async dbContext =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ public async Task Renders_correct_top_level_links_for_page_number(int pageNumber
{
// Arrange
WebAccount account = _fakers.WebAccount.Generate();
account.UserName = $"&{account.UserName}";

const int totalCount = 3 * DefaultPageSize + 3;
List<BlogPost> posts = _fakers.BlogPost.Generate(totalCount);
Expand All @@ -599,7 +598,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
await dbContext.SaveChangesAsync();
});

string routePrefix = $"/blogPosts?filter=equals(author.userName,'{WebUtility.UrlEncode(account.UserName)}')" +
string routePrefix = $"/blogPosts?filter=equals(author.userName,'{account.UserName}')" +
"&fields[webAccounts]=userName&include=author&sort=id&foo=bar,baz";

string route = $"{routePrefix}&page[number]={pageNumber}";
Expand Down

0 comments on commit 5c1648a

Please sign in to comment.