tidying up configuration creation

This commit is contained in:
Tom Gardham-Pallister
2017-02-08 07:37:04 +00:00
parent 7fffc9827a
commit dbe28d38bc
2 changed files with 40 additions and 41 deletions

View File

@ -6,6 +6,7 @@ using Moq;
using Ocelot.Authentication.Handler;
using Ocelot.Authentication.Handler.Creator;
using Ocelot.Authentication.Handler.Factory;
using Ocelot.Configuration.Builder;
using Ocelot.Errors;
using Ocelot.Responses;
using Shouldly;
@ -33,7 +34,11 @@ namespace Ocelot.UnitTests.Authentication
[Fact]
public void should_return_identity_server_access_token_handler()
{
this.Given(x => x.GivenTheAuthenticationOptionsAre(new AuthenticationOptions("IdentityServer", "","",false, new List<string>(), "")))
var authenticationOptions = new AuthenticationOptionsBuilder()
.WithProvider("IdentityServer")
.Build();
this.Given(x => x.GivenTheAuthenticationOptionsAre(authenticationOptions))
.And(x => x.GivenTheCreatorReturns())
.When(x => x.WhenIGetFromTheFactory())
.Then(x => x.ThenTheHandlerIsReturned("IdentityServer"))
@ -43,7 +48,10 @@ namespace Ocelot.UnitTests.Authentication
[Fact]
public void should_return_error_if_cannot_create_handler()
{
this.Given(x => x.GivenTheAuthenticationOptionsAre(new AuthenticationOptions("IdentityServer", "", "", false, new List<string>(), "")))
var authenticationOptions = new AuthenticationOptionsBuilder()
.Build();
this.Given(x => x.GivenTheAuthenticationOptionsAre(authenticationOptions))
.And(x => x.GivenTheCreatorReturnsAnError())
.When(x => x.WhenIGetFromTheFactory())
.Then(x => x.ThenAnErrorResponseIsReturned())