Compare commits

...

3 Commits

Author SHA1 Message Date
Sergey Chebotar
2cef4d1d9f Add RhSolutions formula test 2023-03-23 07:18:11 +03:00
Sergey Chebotar
6497738c2d Add Test template 2023-03-23 07:08:30 +03:00
Sergey Chebotar
4f448f2034 Add basic test 2023-03-22 08:36:13 +03:00
33 changed files with 103 additions and 3 deletions

View File

@ -13,10 +13,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ExcelDna.AddIn" Version="1.6.0" /> <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.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="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="RhSolutions.Sku" Version="0.1.1" />
<PackageReference Include="System.Net.Http" Version="4.3.4" /> <PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,30 @@
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);
}
}

View File

@ -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>

View File

@ -0,0 +1,30 @@
namespace RhSolutions.Tests;
[ExcelTestSettings(AddIn = @"..\..\..\..\RhSolutions.AddIn\bin\Debug\net6.0-windows\RhSolutions-AddIn")]
public class RhSolutionsCheckTest : IDisposable
{
private Workbook workbook;
public RhSolutionsCheckTest()
{
workbook = Util.Application.Workbooks.Add();
}
[ExcelFact]
public void RhSolutionsFunctionWorks()
{
var ws = workbook.Sheets[1];
ws.Range["A1"].Formula = "=RHSOLUTIONS(\"гильза 16\")";
Util.Application.CalculateFull();
var result = ws.Range["A1"].Value;
Assert.Equal("Загрузка...", result);
}
public void Dispose()
{
Util.Application.ActiveWorkbook.Close(SaveChanges: false);
}
}

View File

@ -0,0 +1,3 @@
global using Xunit;
global using Microsoft.Office.Interop.Excel;
global using ExcelDna.Testing;

View File

@ -0,0 +1,16 @@
//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);
// }
//}

View File

@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339 VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution 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}.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.ActiveCfg = Release|Any CPU
{18A2FF67-0E46-4A86-B872-29F2B3F23ADF}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE