public void CreateSpreadSheetTest() { ExcelService service = new ExcelService(); bool isActual = service.CreateSpreadSheet(); bool isExpected = true; Assert.AreEqual(isExpected, isActual); }
public ActionResult GetExcelFile() { MemoryStream excelStream = new MemoryStream(); var excelFile = new ExcelService(); bool fileCreated = excelFile.CreateSpreadSheet(); excelStream = excelFile.SpreadsheetStream; HttpContext.Response.Clear(); HttpContext.Response.AddHeader("content-disposition", "attachment;filename=test.xls"); excelStream.WriteTo(HttpContext.Response.OutputStream); excelStream.Close(); HttpContext.Response.End(); return(View()); }