mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-23 00:32:50 +08:00
morehaking about
This commit is contained in:
parent
4dac8cb4fb
commit
816221c7a6
@ -27,7 +27,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
[Fact]
|
||||
public void can_add_config()
|
||||
{
|
||||
this.Given(x => x.GivenTheConfigurationIs(new FakeConfig("initial")))
|
||||
this.Given(x => x.GivenTheConfigurationIs(new FakeConfig("initial", "adminath")))
|
||||
.When(x => x.WhenIAddOrReplaceTheConfig())
|
||||
.Then(x => x.ThenNoErrorsAreReturned())
|
||||
.BDDfy();
|
||||
@ -54,7 +54,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
private void GivenThereIsASavedConfiguration()
|
||||
{
|
||||
GivenTheConfigurationIs(new FakeConfig("initial"));
|
||||
GivenTheConfigurationIs(new FakeConfig("initial", "adminath"));
|
||||
WhenIAddOrReplaceTheConfig();
|
||||
}
|
||||
|
||||
@ -77,17 +77,10 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
private readonly string _downstreamTemplatePath;
|
||||
|
||||
public FakeConfig(string downstreamTemplatePath)
|
||||
public FakeConfig(string downstreamTemplatePath, string administrationPath)
|
||||
{
|
||||
_downstreamTemplatePath = downstreamTemplatePath;
|
||||
}
|
||||
|
||||
public string AdministrationPath
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
AdministrationPath = administrationPath;
|
||||
}
|
||||
|
||||
public List<ReRoute> ReRoutes => new List<ReRoute>
|
||||
@ -97,6 +90,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.Build()
|
||||
};
|
||||
|
||||
public string AdministrationPath {get;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Controllers;
|
||||
using Ocelot.Responses;
|
||||
@ -30,7 +28,7 @@ namespace Ocelot.UnitTests.Controllers
|
||||
|
||||
this.Given(x => x.GivenTheGetConfigurationReturns(expected))
|
||||
.When(x => x.WhenIGetTheFileConfiguration())
|
||||
.Then(x => x.ThenTheFileConfigurationIsReturned(expected.Data))
|
||||
.Then(x => x.TheTheGetFileConfigurationIsCalledCorrectly())
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
@ -46,8 +44,10 @@ namespace Ocelot.UnitTests.Controllers
|
||||
_result = _controller.Get();
|
||||
}
|
||||
|
||||
private void ThenTheFileConfigurationIsReturned(FileConfiguration expected)
|
||||
private void TheTheGetFileConfigurationIsCalledCorrectly()
|
||||
{
|
||||
_getFileConfig
|
||||
.Verify(x => x.Invoke(), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user