mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-05-01 10:12:51 +08:00

* copied everything from repos back to ocelot repo * added src projects to sln * removed all test projects that have no tests * added all test projects to sln * removed test not on master * merged unit tests * merged acceptance tests * merged integration tests * fixed namepaces * build script creates packages for all projects * updated docs to make sure no references to external repos that we will remove * +semver: breaking
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
namespace Ocelot.UnitTests.Polly
|
|
{
|
|
using System.IO;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Moq;
|
|
using Ocelot.Configuration.Builder;
|
|
using Ocelot.DependencyInjection;
|
|
using Ocelot.Logging;
|
|
using Ocelot.Requester;
|
|
using Provider.Polly;
|
|
using Shouldly;
|
|
using Xunit;
|
|
|
|
public class OcelotBuilderExtensionsTests
|
|
{
|
|
[Fact]
|
|
public void should_build()
|
|
{
|
|
var loggerFactory = new Mock<IOcelotLoggerFactory>();
|
|
var services = new ServiceCollection();
|
|
var options = new QoSOptionsBuilder()
|
|
.WithTimeoutValue(100)
|
|
.WithExceptionsAllowedBeforeBreaking(1)
|
|
.WithDurationOfBreak(200)
|
|
.Build();
|
|
var reRoute = new DownstreamReRouteBuilder().WithQosOptions(options)
|
|
.Build();
|
|
|
|
var configuration = new ConfigurationBuilder()
|
|
.SetBasePath(Directory.GetCurrentDirectory())
|
|
.Build();
|
|
services
|
|
.AddOcelot(configuration)
|
|
.AddPolly();
|
|
var provider = services.BuildServiceProvider();
|
|
|
|
var handler = provider.GetService<QosDelegatingHandlerDelegate>();
|
|
handler.ShouldNotBeNull();
|
|
|
|
var delgatingHandler = handler(reRoute, loggerFactory.Object);
|
|
delgatingHandler.ShouldNotBeNull();
|
|
}
|
|
}
|
|
}
|