Skip to content

Commit 0e8f6df

Browse files
Eits-Ianraman-m
authored andcommitted
Fixed test
Fixed test configuration_is_invalid_with_invalid_authentication_provider()
1 parent d935642 commit 0e8f6df

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test/Ocelot.UnitTests/Configuration/Validation/FileConfigurationFluentValidatorTests.cs

+11-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using Ocelot.UnitTests.Requester;
1515
using Ocelot.Values;
1616
using System.Security.Claims;
17-
using System.Text.Encodings.Web;
17+
using System.Text.Encodings.Web;
1818

1919
namespace Ocelot.UnitTests.Configuration.Validation
2020
{
@@ -461,6 +461,7 @@ public void Configuration_is_invalid_with_invalid_authentication_provider()
461461
.When(x => x.WhenIValidateTheConfiguration())
462462
.Then(x => x.ThenTheResultIsNotValid())
463463
.And(x => x.ThenTheErrorMessageAtPositionIs(0, "Authentication Options AuthenticationProviderKey:'Test',AuthenticationProviderKeys:['Test #1','Test #2'],AllowedScopes:[] is unsupported authentication provider"))
464+
.And(x => x.ThenTheErrorMessageAtPositionIs(0, "Authentication Options AuthenticationProviderKey:Test,AllowedScopes:[],RequiredRole:[],ScopeKey:[],RoleKey:[],PolicyName:[] is unsupported authentication provider"))
464465
.BDDfy();
465466
}
466467

@@ -630,7 +631,7 @@ public void Configuration_is_invalid_when_not_using_service_discovery_and_host(s
630631
[InlineData(Empty, true)]
631632
[InlineData("Test", false)]
632633
public void HaveServiceDiscoveryProviderRegistered_RouteServiceName_Validated(string serviceName, bool valid)
633-
{
634+
{
634635
// Arrange
635636
var route = GivenDefaultRoute();
636637
route.ServiceName = serviceName;
@@ -747,7 +748,7 @@ public void Configuration_is_not_valid_when_host_and_port_is_empty()
747748
.And(x => x.ThenTheErrorMessageAtPositionIs(0, "When not using service discovery Host must be set on DownstreamHostAndPorts if you are not using Route.Host or Ocelot cannot find your service!"))
748749
.BDDfy();
749750
}
750-
751+
751752
[Theory]
752753
[Trait("PR", "1927")]
753754
[InlineData("/foo/{bar}/foo", "/yahoo/foo/{bar}")] // valid
@@ -842,10 +843,10 @@ private FileConfiguration GivenAConfiguration(params FileRoute[] routes)
842843
config.Routes.AddRange(routes);
843844
_fileConfiguration = config;
844845
return config;
845-
}
846+
}
846847

847848
private static FileServiceDiscoveryProvider GivenDefaultServiceDiscoveryProvider() => new()
848-
{
849+
{
849850
Scheme = Uri.UriSchemeHttps,
850851
Host = "localhost",
851852
Type = "ServiceFabric",
@@ -875,8 +876,8 @@ private void ThenTheErrorIs<T>()
875876
private void ThenTheErrorMessageAtPositionIs(int index, string expected)
876877
{
877878
_result.Data.Errors[index].Message.ShouldBe(expected);
878-
}
879-
879+
}
880+
880881
private void ThenThereAreErrors(bool isError)
881882
{
882883
_result.Data.IsError.ShouldBe(isError);
@@ -924,7 +925,7 @@ private class FakeServiceDiscoveryProvider : IServiceDiscoveryProvider
924925
private class TestOptions : AuthenticationSchemeOptions { }
925926

926927
private class TestHandler : AuthenticationHandler<TestOptions>
927-
{
928+
{
928929
// https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/8.0/isystemclock-obsolete
929930
// .NET 8.0: TimeProvider is now a settable property on the Options classes for the authentication and identity components.
930931
// It can be set directly or by registering a provider in the dependency injection container.
@@ -935,9 +936,9 @@ public TestHandler(IOptionsMonitor<TestOptions> options, ILoggerFactory logger,
935936
#else
936937
public TestHandler(IOptionsMonitor<TestOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock)
937938
{
938-
}
939+
}
939940
#endif
940-
941+
941942
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
942943
{
943944
var principal = new ClaimsPrincipal();

0 commit comments

Comments
 (0)