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