How to UnitTest this method properly?
<p>I have a method (below) that is called from a controller in a MVC application which then outputs an excel file.</p>

<p>Method:</p>

<pre><code>public static void ExportToExcel(IEnumerable&lt;dynamic&gt; data, string bookName, string sheetName)
{
    XLWorkbook workbook = new XLWorkbook();
    var worksheet = workbook.Worksheets.Add(sheetName);
    worksheet.Cell(1, 1).InsertTable(data);

    HttpContext.Current.Response.Clear();
    HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
    HttpContext.Current.Response.AddHeader("content-disposition", String.Format(@"attachment;filename={0}.xlsx", bookName.Replace(" ", "_")));

    using (MemoryStream memStream = new MemoryStream())
    {
        workbook.SaveAs(memStream);
        memStream.WriteTo(HttpContext.Current.Response.OutputStream);
        memStream.Close();
    }
    HttpContext.Current.Response.End();
}
</code></pre>

<p>Controller:</p>

<pre><code>[ActionName("ExportData")]
public ActionResult ExportData()
{
    ExcelExport.ExportToExcel(_dbaccess.GetAllData()), "Workbook", "Worksheet");

    return RedirectToAction("Index");
}
</code></pre>

<p>How can I test this method?</p>