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

View File

@ -3,7 +3,10 @@
"Excel": { "Excel": {
"commandName": "Executable", "commandName": "Executable",
"executablePath": "C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE", "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() public CanDoGuess()
{ {
Environment.SetEnvironmentVariable("ISTESTING", "true");
_addIn = new(); _addIn = new();
_addIn.AutoOpen(); _addIn.AutoOpen();
_guessReader = new GuessReader(Util.Application); _guessReader = new GuessReader(Util.Application);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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