public void FindTable_Null_DoesNotMatchTableStandard() { //Arrange string[,] sampleReport = { { "", "", "", "", "" }, { "", "Header1", "Header2", "Header3", "" }, { "", "", "0", "0", "" }, { "", "lol", "Judas", "SaidFrank", "" }, { "", "", "", "", "" } }; //Act ICSVTable actual = CSVTable.FindTable(new Dummy_UniqueNameProvider(), 1, 1, sampleReport); //Assert Assert.IsNull(actual); }
public void FindTable_BlankAndZeroRows_Ignored() { //Arrange string[,] sampleReport = { { "", "", "", "", "" }, { "", "Header1", "Header2", "Header3", "" }, { "", "", "Jank", "0", "" }, { "", "", "0", "0", "" }, { "", "", "", "", "" } }; ICSVTable table = CSVTable.FindTable(new Dummy_UniqueNameProvider(), 1, 1, sampleReport); bool expected = true; //Act bool actual = table.Records.Count() == 1; //Assert Assert.AreEqual(expected, actual); }
public void ToJSON_RetrunsJSONArray() { //Arrange string[,] sampleReport = { { "", "", "", "", "" }, { "", "Header1", "Header2", "Header3", "" }, { "", "", "Jank", "0", "" }, { "", "", "0", "0", "" }, { "", "", "", "", "" } }; IJSONConvertable table = CSVTable.FindTable(new Dummy_UniqueNameProvider(), 1, 1, sampleReport); string jsonSample = "[{\"Header1\":\"\", \"Header2\":\"Jank\", \"Header3\":\"0\"}]"; JToken jsonSampleArray = JArray.Parse(jsonSample); bool expected = true; //Act bool actual = jsonSampleArray.ToString() == table.AsJObject().ToString(); //Assert Assert.AreEqual(expected, actual); }