Template
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using ClosedXML.Excel;
|
|
using FluentAssertions;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NUnit.Framework;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using NUnitSetup = NUnit.Framework.SetUpAttribute;
|
|
|
|
namespace Strata.ContinuousImprovement.Api.Test.Unit.ActionResults
|
|
{
|
|
[TestFixture, Category("Unit"), Category("ContentResult")]
|
|
public class ExcelContentResultTests
|
|
{
|
|
public ExcelContentResult ExcelContentResult { get; set; }
|
|
public IXLWorkbook Workbook { get; set; }
|
|
|
|
[NUnitSetup]
|
|
public void Setup()
|
|
{
|
|
Workbook = new XLWorkbook();
|
|
Workbook.AddWorksheet();
|
|
ExcelContentResult = new ExcelContentResult(Workbook, "Export");
|
|
}
|
|
|
|
[Test()]
|
|
public void ExcelContentResultTest()
|
|
{
|
|
// Assert
|
|
ExcelContentResult.Should().NotBeNull();
|
|
ExcelContentResult.Workbook.Should().NotBeNull();
|
|
ExcelContentResult.FileName.Should().NotBeNullOrEmpty();
|
|
}
|
|
|
|
[Test()]
|
|
public void ExecuteResultTest()
|
|
{
|
|
// Arange
|
|
var actionConext = new ActionContext();
|
|
Action executeResult = () => ExcelContentResult.ExecuteResult(actionConext);
|
|
|
|
executeResult.Should().NotThrow();
|
|
}
|
|
|
|
[Test(), Ignore("We don't currently use this implementation method")]
|
|
public async Task ExecuteResultAsyncTest()
|
|
{
|
|
// Arange
|
|
var actionConext = new ActionContext();
|
|
Assert.DoesNotThrowAsync(async () => await ExcelContentResult.ExecuteResultAsync(actionConext));
|
|
}
|
|
}
|
|
} |