mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 18:48:15 +08:00
* #568 Ocelot wont start if QoSOptions specified and no QoS DelegatingHandler registered e.g. no use of Ocelot.Provider.Polly. Also adds a NoQosDelegatingHandler and logs an error if ive missed something and the user can get to making the request * #568 sadly something wierd with IServiceProvider and FluentValidation so I'm just defaulting to warning and noqosdelegatinghandler if someone doesnt register but provides options, also added basic in memory cache in case people dont use a specific package
This commit is contained in:
@ -1,23 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Validator;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Validator;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Requester;
|
||||
using Requester;
|
||||
|
||||
public class ConfigurationFluentValidationTests
|
||||
{
|
||||
private readonly IConfigurationValidator _configurationValidator;
|
||||
private IConfigurationValidator _configurationValidator;
|
||||
private FileConfiguration _fileConfiguration;
|
||||
private Response<ConfigurationValidationResult> _result;
|
||||
private readonly Mock<IAuthenticationSchemeProvider> _provider;
|
||||
@ -25,8 +28,10 @@ namespace Ocelot.UnitTests.Configuration
|
||||
public ConfigurationFluentValidationTests()
|
||||
{
|
||||
_provider = new Mock<IAuthenticationSchemeProvider>();
|
||||
_configurationValidator = new FileConfigurationFluentValidator(_provider.Object);
|
||||
}
|
||||
var provider = new ServiceCollection()
|
||||
.BuildServiceProvider();
|
||||
_configurationValidator = new FileConfigurationFluentValidator(_provider.Object, provider);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void configuration_is_valid_if_aggregates_are_valid()
|
||||
@ -1046,6 +1051,15 @@ namespace Ocelot.UnitTests.Configuration
|
||||
});
|
||||
}
|
||||
|
||||
private void GivenAQosDelegate()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
QosDelegatingHandlerDelegate del = (a, b) => new FakeDelegatingHandler();
|
||||
services.AddSingleton<QosDelegatingHandlerDelegate>(del);
|
||||
var provider = services.BuildServiceProvider();
|
||||
_configurationValidator = new FileConfigurationFluentValidator(_provider.Object, provider);
|
||||
}
|
||||
|
||||
private class TestOptions : AuthenticationSchemeOptions
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user