public void write_first_level_properties() { var report = new ValueDiagnosticReport(); report.Value("C", 3); report.Value("A", 1); report.Value("B", 2); report.AllValues().Select(x => x.Key) .ShouldHaveTheSameElementsAs("A", "B", "C"); }
public IEnumerable <SettingDataSource> CreateDiagnosticReport() { var report = new ValueDiagnosticReport(); // TODO -- watch this, probably duplicated code _settings.Value.Each(x => { report.StartSource(x); x.WriteReport(report); report.EndSource(); }); return(report.AllValues().Select(x => new SettingDataSource { Key = x.Key, Provenance = x.First().Source, Value = x.First().Value })); }
public void write_enumerable_properties() { var report = new ValueDiagnosticReport(); report.StartChild("A", 0); report.Value("B", 0); report.EndChild(); report.StartChild("A", 1); report.Value("B", 1); report.EndChild(); report.StartChild("A", 2); report.Value("B", 2); report.EndChild(); report.AllValues().Select(x => x.Key) .ShouldHaveTheSameElementsAs("A[0].B", "A[1].B", "A[2].B"); }
public void write_second_level_properties() { var report = new ValueDiagnosticReport(); report.StartChild("A"); report.Value("B", 2); report.StartChild("C"); report.Value("D", 4); report.EndChild(); report.Value("E", 5); report.EndChild(); report.Value("F", 6); report.AllValues().Select(x => x.Key) .ShouldHaveTheSameElementsAs("A.B", "A.C.D", "A.E", "F"); }
public void writes_the_source() { var report = new ValueDiagnosticReport(); report.StartSource(new SettingsData(null, "Ralph")); report.Value("A", 1); report.EndSource(); report.StartSource(new SettingsData(null, "Potsie")); report.Value("A", 2); report.EndSource(); report.AllValues().Single().Key.ShouldEqual("A"); var value = report.For("A"); value.First().ShouldEqual(new DiagnosticValueSource("Ralph", 1)); value.ShouldHaveTheSameElementsAs(new DiagnosticValueSource("Ralph", 1), new DiagnosticValueSource("Potsie", 2)); }