I realised we can get rid of the cookie container as cookies are just sent as a header called cookie...

This commit is contained in:
TomPallister
2017-03-05 18:05:20 +00:00
parent d0118ea4a3
commit c787202374
12 changed files with 344 additions and 392 deletions

View File

@ -195,23 +195,6 @@ namespace Ocelot.UnitTests.Request
_qoSProvider = qoSProvider;
}
[Fact]
public void should_use_cookies()
{
this.Given(x => x.GivenIHaveHttpMethod("GET"))
.And(x => x.GivenIHaveDownstreamUrl("http://www.bbc.co.uk"))
.And(x => x.GivenTheCookiesAre(new RequestCookieCollection(new Dictionary<string, string>
{
{ "TheCookie","Monster" }
})))
.When(x => x.WhenICreateARequest())
.And(x => x.ThenTheCorrectCookiesAreUsed(new RequestCookieCollection(new Dictionary<string, string>
{
{ "TheCookie","Monster" }
})))
.BDDfy();
}
[Fact]
public void should_user_query_string()
{
@ -240,14 +223,14 @@ namespace Ocelot.UnitTests.Request
private void ThenTheCorrectCookiesAreUsed(IRequestCookieCollection expected)
{
var resultCookies = _result.Data.CookieContainer.GetCookies(new Uri(_downstreamUrl + _query));
/* var resultCookies = _result.Data.CookieContainer.GetCookies(new Uri(_downstreamUrl + _query));
var resultDictionary = resultCookies.Cast<Cookie>().ToDictionary(cook => cook.Name, cook => cook.Value);
foreach (var expectedCookie in expected)
{
var resultCookie = resultDictionary[expectedCookie.Key];
resultCookie.ShouldBe(expectedCookie.Value);
}
}*/
}
private void GivenTheCookiesAre(IRequestCookieCollection cookies)
@ -305,7 +288,7 @@ namespace Ocelot.UnitTests.Request
private void WhenICreateARequest()
{
_result = _requestCreator.Build(_httpMethod, _downstreamUrl, _content?.ReadAsStreamAsync().Result, _headers,
_cookies, _query, _contentType, _requestId,_isQos,_qoSProvider).Result;
_query, _contentType, _requestId,_isQos,_qoSProvider).Result;
}