mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-09-18 17:02:42 +08:00
Activate ChangeToken when Ocelot's configuration changes #1037
* Add configuration change token (#1036) * Add IOptionsMonitor<IInternalConfiguration> * Activate change token from *ConfigurationRepository instead of FileAndInternalConfigurationSetter; add acceptance & integration tests * Update documentation * Use IWebHostEnvironment as IHostingEnvironment deprecated Co-authored-by: Chris Swinchatt <chrisswinchatt@gmail.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
namespace Ocelot.UnitTests.Configuration.ChangeTracking
|
||||
{
|
||||
using Ocelot.Configuration.ChangeTracking;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
public class OcelotConfigurationChangeTokenSourceTests
|
||||
{
|
||||
private readonly IOcelotConfigurationChangeTokenSource _source;
|
||||
|
||||
public OcelotConfigurationChangeTokenSourceTests()
|
||||
{
|
||||
_source = new OcelotConfigurationChangeTokenSource();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_activate_change_token()
|
||||
{
|
||||
this.Given(_ => GivenIActivateTheChangeTokenSource())
|
||||
.Then(_ => ThenTheChangeTokenShouldBeActivated())
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenIActivateTheChangeTokenSource()
|
||||
{
|
||||
_source.Activate();
|
||||
}
|
||||
|
||||
private void ThenTheChangeTokenShouldBeActivated()
|
||||
{
|
||||
_source.ChangeToken.HasChanged.ShouldBeTrue();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user