RhSolutions-AddIn/RhSolutions.Tests/WorkbookValidationTests.cs

39 lines
992 B
C#

using RhSolutions.AddIn;
namespace RhSolutions.Tests;
[ExcelTestSettings(OutOfProcess = true)]
public class WorkbookValidationTests : IDisposable
{
private readonly RhSolutionsAddIn _addIn;
public WorkbookValidationTests()
{
_addIn = new RhSolutionsAddIn();
_addIn.AutoOpen();
Util.Application.Workbooks.Add();
}
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyTestTable.xlsx")]
public void WorksheetIsCorrect()
{
Worksheet ws = Util.Workbook.Sheets[1];
ws.Validate();
Assert.True(WorksheetValidator.IsValid());
}
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyWorkbook.xlsx")]
public void EmptyWorkbookIsNotCorrect()
{
Worksheet ws = Util.Workbook.Sheets[1];
ws.Validate();
Assert.False(WorksheetValidator.IsValid());
}
public void Dispose()
{
_addIn.AutoClose();
Util.Application.ActiveWindow.Close(SaveChanges: false);
}
}