mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-08-04 23:32:26 +08:00
Feat/monorepo (#734)
* 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
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
namespace Ocelot.UnitTests.Eureka
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder.Internal;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Provider.Eureka;
|
||||
using Responses;
|
||||
using Shouldly;
|
||||
using Steeltoe.Common.Discovery;
|
||||
using Xunit;
|
||||
|
||||
public class EurekaMiddlewareConfigurationProviderTests
|
||||
{
|
||||
[Fact]
|
||||
public void should_not_build()
|
||||
{
|
||||
var configRepo = new Mock<IInternalConfigurationRepository>();
|
||||
configRepo.Setup(x => x.Get())
|
||||
.Returns(new OkResponse<IInternalConfiguration>(new InternalConfiguration(null, null, null, null, null, null, null, null)));
|
||||
var services = new ServiceCollection();
|
||||
services.AddSingleton<IInternalConfigurationRepository>(configRepo.Object);
|
||||
var sp = services.BuildServiceProvider();
|
||||
var provider = EurekaMiddlewareConfigurationProvider.Get(new ApplicationBuilder(sp));
|
||||
provider.ShouldBeOfType<Task>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_build()
|
||||
{
|
||||
var serviceProviderConfig = new ServiceProviderConfigurationBuilder().WithType("eureka").Build();
|
||||
var client = new Mock<IDiscoveryClient>();
|
||||
var configRepo = new Mock<IInternalConfigurationRepository>();
|
||||
configRepo.Setup(x => x.Get())
|
||||
.Returns(new OkResponse<IInternalConfiguration>(new InternalConfiguration(null, null, serviceProviderConfig, null, null, null, null, null)));
|
||||
var services = new ServiceCollection();
|
||||
services.AddSingleton<IInternalConfigurationRepository>(configRepo.Object);
|
||||
services.AddSingleton<IDiscoveryClient>(client.Object);
|
||||
var sp = services.BuildServiceProvider();
|
||||
var provider = EurekaMiddlewareConfigurationProvider.Get(new ApplicationBuilder(sp));
|
||||
provider.ShouldBeOfType<Task>();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user