public void TestMethod_DumpJson_anonymous() { Dumper.IsEnabled = true; Dumper.Folder = new DirectoryInfo(Path.Combine(this.TestContext.TestRunResultsDirectory, "dump")); Debug.WriteLine($"Dumper.Folder: {Dumper.Folder}"); var sample = new { A = 10, B = true, C = "Sample" }; var expected = sample.ToJson(); var name = this.TestContext.TestName; Dumper.DumpJson(sample, name, a => a); var f = Dumper.GetDumpFile(name, ".json"); Debug.WriteLine($"file: {f}"); Assert.IsTrue(f.Exists, "Dump file was not created."); var actual = File.ReadAllText(f.FullName); Debug.WriteLine(actual); Assert.AreEqual(expected, actual, "The content of the dump file is not text that is expected."); } // end function