Skip to content

CSV Report

GregFinzer edited this page Dec 20, 2017 · 1 revision

The CSV Reports outputs the results to a comma separated value file. The launch portion will open the file using whatever application is associated with the .csv extension. Normally this is Excel.

[Test]
public void CsvReportTest()
{
	string expected = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "movie.csv");

	if (File.Exists(expected))
		File.Delete(expected);

	Movie movie1 = new Movie();
	movie1.Name = "Oblivion";
	movie1.PaymentForTomCruise = 2000000M;

	Movie movie2 = new Movie();
	movie2.Name = "Edge of Tomorrow";
	movie2.PaymentForTomCruise = 3000000M;

	CompareLogic compareLogic = new CompareLogic();
	compareLogic.Config.MaxDifferences = Int32.MaxValue;
	ComparisonResult result = compareLogic.Compare(movie1, movie2);

	CsvReport csvReport = new CsvReport();
	csvReport.OutputFile(result.Differences, expected);

	Assert.IsTrue(File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, expected)));

	csvReport.LaunchApplication(expected);
}