diff --git a/RhSolutions.AddIn/RhSolutions.AddIn.csproj b/RhSolutions.AddIn/RhSolutions.AddIn.csproj index 022dccc..9b88245 100644 --- a/RhSolutions.AddIn/RhSolutions.AddIn.csproj +++ b/RhSolutions.AddIn/RhSolutions.AddIn.csproj @@ -1,24 +1,25 @@  - - net472;net6.0-windows - Library - RhSolutions.AddIn - RhSolutions.AddIn - false - true - true - - - - - - - - - - - - - - + + net472;net6.0-windows + 10 + Library + RhSolutions.AddIn + RhSolutions.AddIn + false + true + true + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RhSolutions.Tests/CalculationTests.cs b/RhSolutions.Tests/CalculationTests.cs deleted file mode 100644 index d6c54c2..0000000 --- a/RhSolutions.Tests/CalculationTests.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace RhSolutions.Tests; - -public class CalculationTests : IDisposable -{ - private Workbook workbook; - - public CalculationTests() - { - workbook = Util.Application.Workbooks.Add(); - } - - public void Dispose() - { - workbook.Close(SaveChanges: false); - } - - [ExcelFact] - public void NumbersAddCorrectly() - { - var ws = workbook.Sheets[1]; - - ws.Range["A1"].Value = 2.0; - ws.Range["A2"].Value = 3.0; - ws.Range["A3"].Formula = "= A1 + A2"; - - var result = ws.Range["A3"].Value; - - Assert.Equal(5.0, result); - } -} \ No newline at end of file diff --git a/RhSolutions.Tests/RhSolutions.Tests.csproj b/RhSolutions.Tests/RhSolutions.Tests.csproj index d6ec3d7..aeb9c9e 100644 --- a/RhSolutions.Tests/RhSolutions.Tests.csproj +++ b/RhSolutions.Tests/RhSolutions.Tests.csproj @@ -1,14 +1,29 @@  - - net6.0-windows - enable - enable - Library - + + net472 + 10 + enable + enable + Library + - - - + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + diff --git a/RhSolutions.Tests/RhSolutionsCheckTest.cs b/RhSolutions.Tests/RhSolutionsCheckTest.cs index a3a6460..b4d93dc 100644 --- a/RhSolutions.Tests/RhSolutionsCheckTest.cs +++ b/RhSolutions.Tests/RhSolutionsCheckTest.cs @@ -1,30 +1,30 @@ -namespace RhSolutions.Tests; - -[ExcelTestSettings(AddIn = @"..\..\..\..\RhSolutions.AddIn\bin\Debug\net6.0-windows\RhSolutions-AddIn")] -public class RhSolutionsCheckTest : IDisposable +namespace RhSolutions.Tests { - private Workbook workbook; - - public RhSolutionsCheckTest() + [ExcelTestSettings(AddIn = @"..\..\..\..\RhSolutions.AddIn\bin\Debug\net472\RhSolutions-AddIn", OutOfProcess = true)] + public class WorkbookCheck : IDisposable { - workbook = Util.Application.Workbooks.Add(); - } + public WorkbookCheck() + { + Util.Application.Workbooks.Add(); + } - [ExcelFact] - public void RhSolutionsFunctionWorks() - { - var ws = workbook.Sheets[1]; + [ExcelFact(Workbook = @"TestWorkbooks\EmptyTestTable.xlsx")] + public void WorksheetIsCorrect() + { + Worksheet worksheet= Util.Workbook.Sheets[1]; + Assert.True(worksheet.IsRehauSource()); + } - ws.Range["A1"].Formula = "=RHSOLUTIONS(\"гильза 16\")"; - Util.Application.CalculateFull(); + [ExcelFact(Workbook = @"TestWorkbooks\EmptyWorkbook.xlsx")] + public void EmptyWorkbookIsNotCorrect() + { + Worksheet worksheet = Util.Workbook.Sheets[1]; + Assert.False(worksheet.IsRehauSource()); + } - var result = ws.Range["A1"].Value; - - Assert.Equal("Загрузка...", result); - } - - public void Dispose() - { - Util.Application.ActiveWorkbook.Close(SaveChanges: false); + public void Dispose() + { + Util.Application.ActiveWorkbook.Close(SaveChanges: false); + } } } diff --git a/RhSolutions.Tests/TestWorkbooks/EmptyTestTable.xlsx b/RhSolutions.Tests/TestWorkbooks/EmptyTestTable.xlsx new file mode 100644 index 0000000..1df17d6 Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/EmptyTestTable.xlsx differ diff --git a/RhSolutions.Tests/TestWorkbooks/EmptyWorkbook.xlsx b/RhSolutions.Tests/TestWorkbooks/EmptyWorkbook.xlsx new file mode 100644 index 0000000..16f63fd Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/EmptyWorkbook.xlsx differ diff --git a/RhSolutions.Tests/Usings.cs b/RhSolutions.Tests/Usings.cs index ef40d98..74130ca 100644 --- a/RhSolutions.Tests/Usings.cs +++ b/RhSolutions.Tests/Usings.cs @@ -1,3 +1,5 @@ global using Xunit; global using Microsoft.Office.Interop.Excel; global using ExcelDna.Testing; +global using RhSolutions.Models; +global using RhSolutions.Services; diff --git a/RhSolutions.Tests/WorkbookCheckTests.cs b/RhSolutions.Tests/WorkbookCheckTests.cs deleted file mode 100644 index 997134b..0000000 --- a/RhSolutions.Tests/WorkbookCheckTests.cs +++ /dev/null @@ -1,16 +0,0 @@ -//namespace RhSolutions.Tests; - -//[ExcelTestSettings(AddIn = @"..\..\..\..\RhSolutions.AddIn\bin\Debug\net6.0-windows\RhSolutions-AddIn")] -//public class WorkbookCheckTests : IDisposable -//{ -// [ExcelFact(Workbook = @".\Workbooks\EmptyTestTable.xlsx")] -// public void WorksheetIsCorrect() -// { -// Assert.True(true); -// } - -// public void Dispose() -// { -// Util.Application.ActiveWorkbook.Close(SaveChanges: false); -// } -//} \ No newline at end of file