2023-04-06 21:38:11 +03:00
|
|
|
|
using RhSolutions.AddIn;
|
2023-10-17 21:22:42 +03:00
|
|
|
|
using RhSolutions.Tools;
|
2023-04-06 21:38:11 +03:00
|
|
|
|
|
|
|
|
|
namespace RhSolutions.Tests;
|
2023-03-24 06:22:40 +03:00
|
|
|
|
|
|
|
|
|
[ExcelTestSettings(OutOfProcess = true)]
|
2023-03-31 15:27:31 +03:00
|
|
|
|
public class WorkbookValidationTests : IDisposable
|
2023-03-23 07:18:11 +03:00
|
|
|
|
{
|
2023-04-06 21:38:11 +03:00
|
|
|
|
private readonly RhSolutionsAddIn _addIn;
|
|
|
|
|
|
2023-03-31 15:27:31 +03:00
|
|
|
|
public WorkbookValidationTests()
|
2023-03-23 07:18:11 +03:00
|
|
|
|
{
|
2023-04-06 21:38:11 +03:00
|
|
|
|
_addIn = new RhSolutionsAddIn();
|
|
|
|
|
_addIn.AutoOpen();
|
2023-03-24 06:22:40 +03:00
|
|
|
|
Util.Application.Workbooks.Add();
|
|
|
|
|
}
|
2023-03-23 07:18:11 +03:00
|
|
|
|
|
2023-05-21 10:24:02 +03:00
|
|
|
|
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyTestTable.xlsx")]
|
2023-03-24 06:22:40 +03:00
|
|
|
|
public void WorksheetIsCorrect()
|
|
|
|
|
{
|
2023-10-17 21:22:42 +03:00
|
|
|
|
Worksheet worksheet = Util.Workbook.Sheets[1];
|
|
|
|
|
Assert.True(worksheet.IsValidSource());
|
2023-03-24 06:22:40 +03:00
|
|
|
|
}
|
2023-03-23 07:18:11 +03:00
|
|
|
|
|
2023-05-21 10:24:02 +03:00
|
|
|
|
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\EmptyWorkbook.xlsx")]
|
2023-03-24 06:22:40 +03:00
|
|
|
|
public void EmptyWorkbookIsNotCorrect()
|
|
|
|
|
{
|
2023-10-17 21:22:42 +03:00
|
|
|
|
Worksheet worksheet = Util.Workbook.Sheets[1];
|
|
|
|
|
Assert.False(worksheet.IsValidSource());
|
2023-03-24 06:22:40 +03:00
|
|
|
|
}
|
2023-03-23 07:18:11 +03:00
|
|
|
|
|
2023-03-24 06:22:40 +03:00
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
2023-04-06 21:38:11 +03:00
|
|
|
|
_addIn.AutoClose();
|
2023-03-31 15:27:31 +03:00
|
|
|
|
Util.Application.ActiveWindow.Close(SaveChanges: false);
|
2023-03-23 07:18:11 +03:00
|
|
|
|
}
|
2023-04-06 21:38:11 +03:00
|
|
|
|
}
|