public void Combine_and_scope_with_failed_source_should_fail() { var source1 = new JsonStringSource("{ 'a': [1] }"); var source2 = new LazyConstantSource(() => throw new FormatException()); var combinedScopedSource = source1.CombineWith(source2).ScopeTo("a"); new Action(() => provider.Get <int[]>(combinedScopedSource)).Should().Throw <FormatException>(); }
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 }); }