39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using RhSolutions.AddIn;
|
|
using RhSolutions.Tools;
|
|
|
|
namespace RhSolutions.Tests;
|
|
|
|
[ExcelTestSettings(OutOfProcess = true)]
|
|
public class WorkbookValidationTests : IDisposable
|
|
{
|
|
private readonly RhSolutionsAddIn _addIn;
|
|
|
|
public WorkbookValidationTests()
|
|
{
|
|
Environment.SetEnvironmentVariable("ISTESTING", "true");
|
|
_addIn = new RhSolutionsAddIn();
|
|
_addIn.AutoOpen();
|
|
Util.Application.Workbooks.Add();
|
|
}
|
|
|
|
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyTestTable.xlsx")]
|
|
public void WorksheetIsCorrect()
|
|
{
|
|
Worksheet worksheet = Util.Workbook.Sheets[1];
|
|
Assert.True(worksheet.IsValidSource());
|
|
}
|
|
|
|
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyWorkbook.xlsx")]
|
|
public void EmptyWorkbookIsNotCorrect()
|
|
{
|
|
Worksheet worksheet = Util.Workbook.Sheets[1];
|
|
Assert.False(worksheet.IsValidSource());
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_addIn.AutoClose();
|
|
Util.Application.ActiveWindow.Close(SaveChanges: false);
|
|
}
|
|
}
|