Fixt testing environment variable

This commit is contained in:
Serghei Cebotari 2023-12-09 23:04:49 +03:00
parent f448cccbeb
commit a8c192848d
10 changed files with 15 additions and 25 deletions

View File

@ -55,15 +55,9 @@ public sealed class RhSolutionsAddIn : IExcelAddIn
EventsUtil.Initialize();
bool isTesting = Environment.GetEnvironmentVariable("ISTESTING") switch
if (Environment.GetEnvironmentVariable("ISTESTING") == "false")
{
"true" => true,
"false" => false,
_ => false
};
if (!isTesting)
{
//IntelliSenseServer.Install();
IntelliSenseServer.Install();
}
ServicePointManager.SecurityProtocol =
@ -74,15 +68,9 @@ public sealed class RhSolutionsAddIn : IExcelAddIn
{
EventsUtil.Uninitialize();
bool isTesting = Environment.GetEnvironmentVariable("ISTESTING") switch
if (Environment.GetEnvironmentVariable("ISTESTING") == "false")
{
"true" => true,
"false" => false,
_ => false
};
if (!isTesting)
{
//IntelliSenseServer.Uninstall();
IntelliSenseServer.Uninstall();
}
}
}

View File

@ -3,7 +3,10 @@
"Excel": {
"commandName": "Executable",
"executablePath": "C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE",
"commandLineArgs": "RhSolutions-AddIn64.xll"
"commandLineArgs": "RhSolutions-AddIn64.xll",
"environmentVariables": {
"ISTESTING": "false"
}
}
}
}

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<ISTESTING>true</ISTESTING>
</EnvironmentVariables>
</RunConfiguration>
</RunSettings>

View File

@ -13,6 +13,7 @@ public class CanDoGuess : IDisposable
public CanDoGuess()
{
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new();
_addIn.AutoOpen();
_guessReader = new GuessReader(Util.Application);

View File

@ -13,6 +13,7 @@ public class CanFillCouplings : IDisposable
public CanFillCouplings()
{
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new();
_addIn.AutoOpen();
_calculator = new CouplingsCalculator();

View File

@ -13,6 +13,7 @@ public class CanFillSleeves : IDisposable
public CanFillSleeves()
{
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new();
_addIn.AutoOpen();
_calculator = new SleevesCalculator();

View File

@ -12,6 +12,7 @@ public class CanReadProducts : IDisposable
public CanReadProducts()
{
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new();
_testWorkbook = Util.Application.Workbooks.Add();
_addIn.AutoOpen();

View File

@ -12,6 +12,7 @@ public class CanWriteProducts : IDisposable
public CanWriteProducts()
{
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new();
_addIn.AutoOpen();
_reader = new ExcelReader(Util.Application, RhSolutionsAddIn.Configuration);

View File

@ -12,6 +12,7 @@ public class RealPricelistTest : IDisposable
public RealPricelistTest()
{
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new();
_addIn.AutoOpen();
_reader = new ExcelReader(Util.Application, RhSolutionsAddIn.Configuration);

View File

@ -10,6 +10,7 @@ public class WorkbookValidationTests : IDisposable
public WorkbookValidationTests()
{
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new RhSolutionsAddIn();
_addIn.AutoOpen();
Util.Application.Workbooks.Add();