public void ChangeOn_synchronizesOptions_onReload() { var source = new TestConfigureOptionsSource <TestOptions2> { ConfigureAction = o => o.Value = "1" }; var provider = new ServiceCollection() .AddOptions <TestOptions1>("name-1") .ChangeOn <TestOptions2>("name-2") .Configure <IOptionsMonitor <TestOptions2> >((o, m) => o.Value = m.Get("name-2").Value) .Services .AddOptions <TestOptions2>("name-2") .Bind(source) .Services .BuildServiceProvider(); var options1 = provider.GetRequiredService <IOptionsMonitor <TestOptions1> >(); var options2 = provider.GetRequiredService <IOptionsMonitor <TestOptions2> >(); options1.Get("name-1").Value.Should().Be("1"); options2.Get("name-2").Value.Should().Be("1"); source.ConfigureAction = o => o.Value = "2"; source.Reload(); options1.Get("name-1").Value.Should().Be("2"); options2.Get("name-2").Value.Should().Be("2"); }
public MessagingClientFixture( TestConfigureOptionsSource remoteSource, TestConfigureOptionsSource clientSource, ServiceProvider provider, IHost host) { this.remoteSource = remoteSource; this.clientSource = clientSource; this.provider = provider; this.host = host; }