RhSolutions-AddIn/RhSolutions.Tests/WorkbookValidationTests.cs
Sergey Chebotar 93195a9cc9 Add Tests
2023-04-06 21:38:11 +03:00

38 lines
961 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);
}
}