RhSolutions-AddIn/RhSolutions.Tests/WorkbookValidationTests.cs
2023-05-21 10:24:02 +03:00

38 lines
979 B
C#

using RhSolutions.AddIn;
using RhSolutions.Tools;
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 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);
}
}