-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for asp.net core context builder
- Loading branch information
1 parent
884b318
commit 25b1eaa
Showing
3 changed files
with
48 additions
and
8 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
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,36 @@ | ||
using System.Collections.Generic; | ||
using AutoFixture.Xunit2; | ||
using Castle; | ||
using FluentAssertions; | ||
using Microsoft.AspNetCore.Http.Internal; | ||
using Microsoft.Extensions.Primitives; | ||
using Xunit; | ||
|
||
namespace Tests | ||
{ | ||
public class When_creating_request_context | ||
{ | ||
[Theory, AutoData] | ||
public void Should_get_client_id_from_castle_header_if_present( | ||
string castleHeaderValue, | ||
string otherHeader, | ||
string otherHeaderValue, | ||
string cookieValue) | ||
{ | ||
var headers = new Dictionary<string, StringValues>() | ||
{ | ||
["X-Castle-Client-ID"] = castleHeaderValue, | ||
[otherHeader] = otherHeaderValue | ||
}; | ||
|
||
var cookies = new RequestCookieCollection(new Dictionary<string, string>() | ||
{ | ||
["__cid"] = cookieValue | ||
}); | ||
|
||
var result = Context.GetClientId(headers, cookies); | ||
|
||
result.Should().Be(castleHeaderValue); | ||
} | ||
} | ||
} |