mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-30 22:12:51 +08:00

* Allow default k8s namespace to be overridden * Add ServiceNamespace to ReRoute configuration * Remove debug comments * Update unit tests * Unit tests (Eureka) * Update docs * Re-run build
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
namespace Ocelot.UnitTests.Eureka
|
|
{
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Moq;
|
|
using Ocelot.Configuration.Builder;
|
|
using Provider.Eureka;
|
|
using Shouldly;
|
|
using Steeltoe.Common.Discovery;
|
|
using Xunit;
|
|
|
|
public class EurekaProviderFactoryTests
|
|
{
|
|
[Fact]
|
|
public void should_not_get()
|
|
{
|
|
var config = new ServiceProviderConfigurationBuilder().Build();
|
|
var sp = new ServiceCollection().BuildServiceProvider();
|
|
var provider = EurekaProviderFactory.Get(sp, config, null);
|
|
provider.ShouldBeNull();
|
|
}
|
|
|
|
[Fact]
|
|
public void should_get()
|
|
{
|
|
var config = new ServiceProviderConfigurationBuilder().WithType("eureka").Build();
|
|
var client = new Mock<IDiscoveryClient>();
|
|
var services = new ServiceCollection();
|
|
services.AddSingleton<IDiscoveryClient>(client.Object);
|
|
var sp = services.BuildServiceProvider();
|
|
var reRoute = new DownstreamReRouteBuilder()
|
|
.WithServiceName("")
|
|
.Build();
|
|
var provider = EurekaProviderFactory.Get(sp, config, reRoute);
|
|
provider.ShouldBeOfType<Eureka>();
|
|
}
|
|
}
|
|
}
|