mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 07:48:16 +08:00
unit tests for cache clearing passing
This commit is contained in:
46
test/Ocelot.UnitTests/Cache/RegionCreatorTests.cs
Normal file
46
test/Ocelot.UnitTests/Cache/RegionCreatorTests.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Cache;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.Cache
|
||||
{
|
||||
public class RegionCreatorTests
|
||||
{
|
||||
private string _result;
|
||||
private ReRoute _reRoute;
|
||||
|
||||
[Fact]
|
||||
public void should_create_region()
|
||||
{
|
||||
var reRoute = new ReRouteBuilder()
|
||||
.WithUpstreamHttpMethod(new List<string>{"Get"})
|
||||
.WithUpstreamPathTemplate("/test/dummy")
|
||||
.Build();
|
||||
|
||||
this.Given(_ => GivenTheReRoute(reRoute))
|
||||
.When(_ => WhenICreateTheRegion())
|
||||
.Then(_ => ThenTheRegionIs("Get /test/dummy"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenTheReRoute(ReRoute reRoute)
|
||||
{
|
||||
_reRoute = reRoute;
|
||||
}
|
||||
|
||||
private void WhenICreateTheRegion()
|
||||
{
|
||||
RegionCreator regionCreator = new RegionCreator();
|
||||
_result = regionCreator.Region(_reRoute);
|
||||
}
|
||||
|
||||
private void ThenTheRegionIs(string expected)
|
||||
{
|
||||
_result.ShouldBe(expected);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user