private void GenerateTotals(Requirement req, int row) { var totals = from t in Matrix.Tests where req.TestIds.Contains(t.Id) group t by t.MatrixState into res select new KeyValuePair <string, int>(res.Key, res.Count()); var stateCol = 4; new[] { "Passed", "Failed", "Blocked", "Not run" }.ToList().ForEach(state => { var total = GetTotal(state, totals); if (total == 0) { Worksheet.Cells[row, stateCol++] = ""; } else { Worksheet.Cells[row, stateCol++] = total; } }); }
private void GenerateTotals(Requirement req, int row) { var totals = from t in Matrix.Tests where req.TestIds.Contains(t.Id) group t by t.MatrixState into res select new KeyValuePair<string, int>(res.Key, res.Count()); var stateCol = 4; new[] { "Passed", "Failed", "Blocked", "Not run" }.ToList().ForEach(state => { var total = GetTotal(state, totals); if (total == 0) { Worksheet.Cells[row, stateCol++] = ""; } else { Worksheet.Cells[row, stateCol++] = total; } }); }