public void TestMethods_DumpTsvHeader_DumpTsvRecord_anonymous() { Dumper.IsEnabled = true; Dumper.Folder = new DirectoryInfo(Path.Combine(this.TestContext.TestRunResultsDirectory, "dump")); Debug.WriteLine($"Dumper.Folder: {Dumper.Folder}"); var sample = from i in new int[] { 1, 2, 3 } select new { A = i, B = true, C = "Sample" + i.ToString() }; var name = this.TestContext.TestName; var expected = "A\tB\tC\r\n" + "1\tTrue\tSample1\r\n" + "2\tTrue\tSample2\r\n" + "3\tTrue\tSample3\r\n"; Dumper.DumpTsvHeader(sample.FirstOrDefault(), name, a => a); foreach (var item in sample) { Dumper.DumpTsvRecord(item, name, a => a); } // next item var f = Dumper.GetDumpFile(name, ".tsv"); Debug.WriteLine(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