diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-03-22 08:36:13 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-03-22 08:36:13 +0300 |
commit | 4f448f203471a19a1444555a895f503515ad2fda (patch) | |
tree | 301b7df2561d650e4d300d24341342bd77ac7f3e | |
parent | 6484cac4f025bd84f7ffa2b2030d729dafe09d3d (diff) |
Add basic test
-rw-r--r-- | RhSolutions.AddIn/AddIn/Functions.cs (renamed from src/AddIn/Functions.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs (renamed from src/AddIn/RhSolutionsAddIn.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Controllers/CombineTool.cs (renamed from src/Controllers/CombineTool.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Controllers/ConvertTool.cs (renamed from src/Controllers/ConvertTool.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Controllers/ExportTool.cs (renamed from src/Controllers/ExportTool.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Controllers/MergeTool.cs (renamed from src/Controllers/MergeTool.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Controllers/RibbonController.cs (renamed from src/Controllers/RibbonController.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Controllers/ToolBase.cs (renamed from src/Controllers/ToolBase.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/Dialog.cs (renamed from src/Models/Dialog.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/PriceListBase.cs (renamed from src/Models/PriceListBase.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/PriceListHeaders.cs (renamed from src/Models/PriceListHeaders.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/Product.cs (renamed from src/Models/Product.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/ProgressBar.cs (renamed from src/Models/ProgressBar.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/ResultBar.cs (renamed from src/Models/ResultBar.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/SourcePriceList.cs (renamed from src/Models/SourcePriceList.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/StatusbarBase.cs (renamed from src/Models/StatusbarBase.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/TargetPriceList.cs (renamed from src/Models/TargetPriceList.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Models/WorksheetExtensions.cs (renamed from src/Models/WorksheetExtensions.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Properties/AssemblyInfo.cs (renamed from src/Properties/AssemblyInfo.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Properties/ExcelDna.Build.props (renamed from src/Properties/ExcelDna.Build.props) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Properties/launchSettings.json (renamed from src/Properties/launchSettings.json) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/RhSolutions-AddIn.dna (renamed from src/RhSolutions-AddIn.dna) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/RhSolutions.AddIn.csproj (renamed from src/RhSolutions.csproj) | 5 | ||||
-rw-r--r-- | RhSolutions.AddIn/Services/EventsUtil.cs (renamed from src/Services/EventsUtil.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Services/RegistryUtil.cs (renamed from src/Services/RegistryUtil.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/Services/RhDatabaseClient.cs (renamed from src/Services/RhDatabaseClient.cs) | 0 | ||||
-rw-r--r-- | RhSolutions.AddIn/app.config (renamed from src/app.config) | 0 | ||||
-rw-r--r-- | RhSolutions.Tests/RhSolutions.Tests.csproj | 14 | ||||
-rw-r--r-- | RhSolutions.Tests/Tests.cs | 38 | ||||
-rw-r--r-- | RhSolutions.Tests/Usings.cs | 3 | ||||
-rw-r--r-- | RhSolutions.sln | 8 |
31 files changed, 65 insertions, 3 deletions
diff --git a/src/AddIn/Functions.cs b/RhSolutions.AddIn/AddIn/Functions.cs index 6a7fc54..6a7fc54 100644 --- a/src/AddIn/Functions.cs +++ b/RhSolutions.AddIn/AddIn/Functions.cs diff --git a/src/AddIn/RhSolutionsAddIn.cs b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs index a4c6019..a4c6019 100644 --- a/src/AddIn/RhSolutionsAddIn.cs +++ b/RhSolutions.AddIn/AddIn/RhSolutionsAddIn.cs diff --git a/src/Controllers/CombineTool.cs b/RhSolutions.AddIn/Controllers/CombineTool.cs index 4d84d44..4d84d44 100644 --- a/src/Controllers/CombineTool.cs +++ b/RhSolutions.AddIn/Controllers/CombineTool.cs diff --git a/src/Controllers/ConvertTool.cs b/RhSolutions.AddIn/Controllers/ConvertTool.cs index 5b2cd4d..5b2cd4d 100644 --- a/src/Controllers/ConvertTool.cs +++ b/RhSolutions.AddIn/Controllers/ConvertTool.cs diff --git a/src/Controllers/ExportTool.cs b/RhSolutions.AddIn/Controllers/ExportTool.cs index e2bbde4..e2bbde4 100644 --- a/src/Controllers/ExportTool.cs +++ b/RhSolutions.AddIn/Controllers/ExportTool.cs diff --git a/src/Controllers/MergeTool.cs b/RhSolutions.AddIn/Controllers/MergeTool.cs index dec8ff7..dec8ff7 100644 --- a/src/Controllers/MergeTool.cs +++ b/RhSolutions.AddIn/Controllers/MergeTool.cs diff --git a/src/Controllers/RibbonController.cs b/RhSolutions.AddIn/Controllers/RibbonController.cs index 148daca..148daca 100644 --- a/src/Controllers/RibbonController.cs +++ b/RhSolutions.AddIn/Controllers/RibbonController.cs diff --git a/src/Controllers/ToolBase.cs b/RhSolutions.AddIn/Controllers/ToolBase.cs index 08493d4..08493d4 100644 --- a/src/Controllers/ToolBase.cs +++ b/RhSolutions.AddIn/Controllers/ToolBase.cs diff --git a/src/Models/Dialog.cs b/RhSolutions.AddIn/Models/Dialog.cs index abc89b8..abc89b8 100644 --- a/src/Models/Dialog.cs +++ b/RhSolutions.AddIn/Models/Dialog.cs diff --git a/src/Models/PriceListBase.cs b/RhSolutions.AddIn/Models/PriceListBase.cs index 95f385d..95f385d 100644 --- a/src/Models/PriceListBase.cs +++ b/RhSolutions.AddIn/Models/PriceListBase.cs diff --git a/src/Models/PriceListHeaders.cs b/RhSolutions.AddIn/Models/PriceListHeaders.cs index c9a8370..c9a8370 100644 --- a/src/Models/PriceListHeaders.cs +++ b/RhSolutions.AddIn/Models/PriceListHeaders.cs diff --git a/src/Models/Product.cs b/RhSolutions.AddIn/Models/Product.cs index 2f092d1..2f092d1 100644 --- a/src/Models/Product.cs +++ b/RhSolutions.AddIn/Models/Product.cs diff --git a/src/Models/ProgressBar.cs b/RhSolutions.AddIn/Models/ProgressBar.cs index 82012e5..82012e5 100644 --- a/src/Models/ProgressBar.cs +++ b/RhSolutions.AddIn/Models/ProgressBar.cs diff --git a/src/Models/ResultBar.cs b/RhSolutions.AddIn/Models/ResultBar.cs index 655540c..655540c 100644 --- a/src/Models/ResultBar.cs +++ b/RhSolutions.AddIn/Models/ResultBar.cs diff --git a/src/Models/SourcePriceList.cs b/RhSolutions.AddIn/Models/SourcePriceList.cs index dc950eb..dc950eb 100644 --- a/src/Models/SourcePriceList.cs +++ b/RhSolutions.AddIn/Models/SourcePriceList.cs diff --git a/src/Models/StatusbarBase.cs b/RhSolutions.AddIn/Models/StatusbarBase.cs index fbec70e..fbec70e 100644 --- a/src/Models/StatusbarBase.cs +++ b/RhSolutions.AddIn/Models/StatusbarBase.cs diff --git a/src/Models/TargetPriceList.cs b/RhSolutions.AddIn/Models/TargetPriceList.cs index 2dcd48e..2dcd48e 100644 --- a/src/Models/TargetPriceList.cs +++ b/RhSolutions.AddIn/Models/TargetPriceList.cs diff --git a/src/Models/WorksheetExtensions.cs b/RhSolutions.AddIn/Models/WorksheetExtensions.cs index 6b5fc3e..6b5fc3e 100644 --- a/src/Models/WorksheetExtensions.cs +++ b/RhSolutions.AddIn/Models/WorksheetExtensions.cs diff --git a/src/Properties/AssemblyInfo.cs b/RhSolutions.AddIn/Properties/AssemblyInfo.cs index 78f4a31..78f4a31 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/RhSolutions.AddIn/Properties/AssemblyInfo.cs diff --git a/src/Properties/ExcelDna.Build.props b/RhSolutions.AddIn/Properties/ExcelDna.Build.props index f5fdab1..f5fdab1 100644 --- a/src/Properties/ExcelDna.Build.props +++ b/RhSolutions.AddIn/Properties/ExcelDna.Build.props diff --git a/src/Properties/launchSettings.json b/RhSolutions.AddIn/Properties/launchSettings.json index c36dbc3..c36dbc3 100644 --- a/src/Properties/launchSettings.json +++ b/RhSolutions.AddIn/Properties/launchSettings.json diff --git a/src/RhSolutions-AddIn.dna b/RhSolutions.AddIn/RhSolutions-AddIn.dna index 5322868..5322868 100644 --- a/src/RhSolutions-AddIn.dna +++ b/RhSolutions.AddIn/RhSolutions-AddIn.dna diff --git a/src/RhSolutions.csproj b/RhSolutions.AddIn/RhSolutions.AddIn.csproj index 60182f6..022dccc 100644 --- a/src/RhSolutions.csproj +++ b/RhSolutions.AddIn/RhSolutions.AddIn.csproj @@ -13,10 +13,11 @@ </PropertyGroup> <ItemGroup> <PackageReference Include="ExcelDna.AddIn" Version="1.6.0" /> + <PackageReference Include="ExcelDna.Integration" Version="1.6.0" /> <PackageReference Include="ExcelDna.IntelliSense" Version="1.6.0" /> - <PackageReference Include="ExcelDna.Interop" Version="15.0.0" /> + <PackageReference Include="ExcelDna.Interop" Version="15.0.1" /> <PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> - <PackageReference Include="Newtonsoft.Json" Version="13.0.2" /> + <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="RhSolutions.Sku" Version="0.1.1" /> <PackageReference Include="System.Net.Http" Version="4.3.4" /> </ItemGroup> diff --git a/src/Services/EventsUtil.cs b/RhSolutions.AddIn/Services/EventsUtil.cs index bb37125..bb37125 100644 --- a/src/Services/EventsUtil.cs +++ b/RhSolutions.AddIn/Services/EventsUtil.cs diff --git a/src/Services/RegistryUtil.cs b/RhSolutions.AddIn/Services/RegistryUtil.cs index 8b165ea..8b165ea 100644 --- a/src/Services/RegistryUtil.cs +++ b/RhSolutions.AddIn/Services/RegistryUtil.cs diff --git a/src/Services/RhDatabaseClient.cs b/RhSolutions.AddIn/Services/RhDatabaseClient.cs index 70530ae..70530ae 100644 --- a/src/Services/RhDatabaseClient.cs +++ b/RhSolutions.AddIn/Services/RhDatabaseClient.cs diff --git a/src/app.config b/RhSolutions.AddIn/app.config index eaef242..eaef242 100644 --- a/src/app.config +++ b/RhSolutions.AddIn/app.config diff --git a/RhSolutions.Tests/RhSolutions.Tests.csproj b/RhSolutions.Tests/RhSolutions.Tests.csproj new file mode 100644 index 0000000..d6ec3d7 --- /dev/null +++ b/RhSolutions.Tests/RhSolutions.Tests.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net6.0-windows</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + <OutputType>Library</OutputType> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="ExcelDna.Testing" Version="1.6.0" /> + </ItemGroup> + +</Project> diff --git a/RhSolutions.Tests/Tests.cs b/RhSolutions.Tests/Tests.cs new file mode 100644 index 0000000..3d1e988 --- /dev/null +++ b/RhSolutions.Tests/Tests.cs @@ -0,0 +1,38 @@ +namespace RhSolutions.Tests +{ + [ExcelTestSettings(AddIn = @"..\..\..\..\RhSolutions.AddIn\bin\Debug\net6.0-windows\RhSolutions-AddIn")] + public class CalculationTests : IDisposable + { + Workbook _testWorkbook; + + public CalculationTests() + { + // Get hold of the Excel Application object and create a workbook + _testWorkbook = Util.Application.Workbooks.Add(); + } + + public void Dispose() + { + // Clean up our workbook without saving changes + _testWorkbook.Close(SaveChanges: false); + } + + [ExcelFact] + public void NumbersAddCorrectly() + { + // We'll just do our test on the first sheet + var ws = _testWorkbook.Sheets[1]; + + // Write two numbers to the active sheet, and a formula that adds them, together + ws.Range["A1"].Value = 2.0; + ws.Range["A2"].Value = 3.0; + ws.Range["A3"].Formula = "= A1 + A2"; + + // Read back the value from the cell with the formula + var result = ws.Range["A3"].Value; + + // Check that we have the expected result + Assert.Equal(5.0, result); + } + } +}
\ No newline at end of file diff --git a/RhSolutions.Tests/Usings.cs b/RhSolutions.Tests/Usings.cs new file mode 100644 index 0000000..ef40d98 --- /dev/null +++ b/RhSolutions.Tests/Usings.cs @@ -0,0 +1,3 @@ +global using Xunit; +global using Microsoft.Office.Interop.Excel; +global using ExcelDna.Testing; diff --git a/RhSolutions.sln b/RhSolutions.sln index e1850b4..8d94b9b 100644 --- a/RhSolutions.sln +++ b/RhSolutions.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.32112.339 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions", "src\RhSolutions.csproj", "{18A2FF67-0E46-4A86-B872-29F2B3F23ADF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RhSolutions.AddIn", "RhSolutions.AddIn\RhSolutions.AddIn.csproj", "{18A2FF67-0E46-4A86-B872-29F2B3F23ADF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RhSolutions.Tests", "RhSolutions.Tests\RhSolutions.Tests.csproj", "{6EECCDDB-741C-404A-874F-BB8656265162}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {18A2FF67-0E46-4A86-B872-29F2B3F23ADF}.Debug|Any CPU.Build.0 = Debug|Any CPU {18A2FF67-0E46-4A86-B872-29F2B3F23ADF}.Release|Any CPU.ActiveCfg = Release|Any CPU {18A2FF67-0E46-4A86-B872-29F2B3F23ADF}.Release|Any CPU.Build.0 = Release|Any CPU + {6EECCDDB-741C-404A-874F-BB8656265162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6EECCDDB-741C-404A-874F-BB8656265162}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6EECCDDB-741C-404A-874F-BB8656265162}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6EECCDDB-741C-404A-874F-BB8656265162}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE |