public void AddTable_AddsToContainer() { //Arrange ICSVTable table = new Dummy_CSVTable(); IUniqueNameProvider nameProvider = new Dummy_UniqueNameProvider(); IReportContainer reportContainer = new ReportContainer(nameProvider); bool expected = true; //Act reportContainer.AddTable(table); bool actual = reportContainer.Tables.Count == 1; //Assert Assert.AreEqual(expected, actual); }
public void ToJSON_IncludesAddedTables() { //Arrange string sample = "{\"table_1\":[{\"name\":\"sam\", \"age\":42},{\"name\":\"tom\", \"age\":77}],\"table_2\":[{\"name\":\"sam\", \"favorite-Food\":\"pizza\"},{\"name\":\"tom\", \"favorite-Food\":\"apples\"}]}"; JObject sampleObject = JObject.Parse(sample); IReportContainer reportContainer = new ReportContainer(new Dummy_UniqueNameProvider()); ICSVTable table_1 = new Dummy_CSVTable("[{\"name\":\"sam\", \"age\":42},{\"name\":\"tom\", \"age\":77}]"); ICSVTable table_2 = new Dummy_CSVTable("[{\"name\":\"sam\", \"favorite-Food\":\"pizza\"},{\"name\":\"tom\", \"favorite-Food\":\"apples\"}]"); reportContainer.AddTable("table_1", table_1); reportContainer.AddTable("table_2", table_2); bool expected = true; //Act string resultJSON = reportContainer.ToJSON(); bool actual = resultJSON == sampleObject.ToString(); //Assert Assert.AreEqual(expected, actual); }