public void Should_propagate_changes_to_observers_on_external_push() { var source = new JsonStringSource("{ }"); source.Push(TestCase.Json); source.Observe() .ShouldStartWithIn(1.Seconds(), (TestCase.SettingsNode, null as Exception)); }
public void Combined_and_scoped_sources_should_work_correctly() { var source1 = new JsonStringSource("{ 'a': [1, 2, 3] }"); var source2 = new JsonStringSource("{ 'a': [4], 'b': '5' }"); provider.Get <int[]>(source1.CombineWith(source2, new SettingsMergeOptions { ArrayMergeStyle = ArrayMergeStyle.Concat }).ScopeTo("a")) .Should() .BeEquivalentTo(new[] { 1, 2, 3, 4 }); }
public void Combined_and_scoped_sources_should_reflect_updates() { using (var temporaryFile = new TemporaryFile("{ 'a': [1] }")) { var source1 = CreateJsonFileSource(temporaryFile.FileName); var source2 = new JsonStringSource("{ 'a': [3], 'b': '4' }"); var combinedScopedSource = source1.CombineWith(source2, new SettingsMergeOptions { ArrayMergeStyle = ArrayMergeStyle.Concat }).ScopeTo("a"); provider.Get <int[]>(combinedScopedSource) .Should() .BeEquivalentTo(new [] { 1, 3 }); File.WriteAllText(temporaryFile.FileName, "{ 'a': [2] }"); Action assertion = () => provider.Get <int[]>(combinedScopedSource) .Should() .BeEquivalentTo(new [] { 2, 3 }); assertion.ShouldPassIn(1.Seconds()); } }