public async Task ShouldBeSameAsExpectedOutput() { var aggregateData = new AggregateGDP(); var actualData = new AggregatedData(); var expectedData = new AggregatedData(); await aggregateData.AggregatePopulationAndGDPData(@"data/datafile.csv"); string actualContent; using (var reader = new StreamReader(Environment.CurrentDirectory + @"/output/output.json")) { actualContent = await reader.ReadToEndAsync(); } actualData.DeserializeData(actualContent); string expectedContent; using (var reader = new StreamReader(Environment.CurrentDirectory + @"../../../../expected-output.json")) { expectedContent = await reader.ReadToEndAsync(); } expectedData.DeserializeData(expectedContent); Assert.Equal(actualData, expectedData); }
public async void Test1() { AggregateGDP c = new AggregateGDP(); await c.readcsv(); JObject createdfile = JObject.Parse(File.ReadAllText(@"../../../../AggregateGDPPopulation/data/output.json")); JObject expectedfile = JObject.Parse(File.ReadAllText(@"../../../../AggregateGDPPopulation.Tests/expected-output.json")); Console.WriteLine(createdfile); Console.WriteLine(expectedfile); Assert.Equal(createdfile, expectedfile); }