Skip to content

Commit

Permalink
Fix ApplicationInstaller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Shvedun committed Dec 6, 2024
1 parent c6bbf9a commit 7aa744a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions clio.tests/ApplicationInstallerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void RestartApplicationAfterInstallPackageInNet6() {
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var applicationLogProvider = Substitute.For<IApplicationLogProvider>();
var logger = Substitute.For<ILogger>();
var packageLockManager = Substitute.For<IPackageLockManager>();
var clioFileSystem = new FileSystem(FileSystem);
ApplicationInstaller applicationInstaller = new ApplicationInstaller(applicationLogProvider,
environmentSettings,
Expand All @@ -35,7 +36,8 @@ public void RestartApplicationAfterInstallPackageInNet6() {
scriptExecutor,
serviceUrlBuilder,
clioFileSystem,
logger
logger,
packageLockManager
);
applicationInstaller.Install(packagePath, environmentSettings);
application.Received(1).Restart();
Expand All @@ -58,6 +60,7 @@ public void RestartApplicationAfterInstallFolderInNet6() {
var scriptExecutor = Substitute.For<ISqlScriptExecutor>();
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var logger = Substitute.For<ILogger>();
var packageLockManager = Substitute.For<IPackageLockManager>();
var clioFileSystem = new FileSystem(FileSystem);
var applicationLogProvider = Substitute.For<IApplicationLogProvider>();
ApplicationInstaller applicationInstaller = new ApplicationInstaller(applicationLogProvider,
Expand All @@ -68,7 +71,8 @@ public void RestartApplicationAfterInstallFolderInNet6() {
scriptExecutor,
serviceUrlBuilder,
clioFileSystem,
logger
logger,
packageLockManager
);
applicationInstaller.Install(packageFolderPath, environmentSettings);
application.Received(1).Restart();
Expand All @@ -91,6 +95,7 @@ public void CatchRestartApplicationErrorAfterInstallFolderInNet6() {
var scriptExecutor = Substitute.For<ISqlScriptExecutor>();
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var logger = Substitute.For<ILogger>();
var packageLockManager = Substitute.For<IPackageLockManager>();
var clioFileSystem = new FileSystem(FileSystem);
var applicationLogProvider = Substitute.For<IApplicationLogProvider>();
ApplicationInstaller applicationInstaller = new ApplicationInstaller(applicationLogProvider,
Expand All @@ -101,7 +106,8 @@ public void CatchRestartApplicationErrorAfterInstallFolderInNet6() {
scriptExecutor,
serviceUrlBuilder,
clioFileSystem,
logger
logger,
packageLockManager
);
Assert.DoesNotThrow(
() => applicationInstaller.Install(packageFolderPath, environmentSettings)
Expand All @@ -126,6 +132,7 @@ public void ReturnErrorApplicationErrorAfterInstallFolderInNet6() {
var scriptExecutor = Substitute.For<ISqlScriptExecutor>();
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var logger = Substitute.For<ILogger>();
var packageLockManager = Substitute.For<IPackageLockManager>();
var clioFileSystem = new FileSystem(FileSystem);
var applicationLogProvider = Substitute.For<IApplicationLogProvider>();
applicationLogProvider.GetInstallationLog(Arg.Any<EnvironmentSettings>()).Returns("SOME LOG WITHOUT SUCCESS MESSAGE");
Expand All @@ -137,7 +144,8 @@ public void ReturnErrorApplicationErrorAfterInstallFolderInNet6() {
scriptExecutor,
serviceUrlBuilder,
clioFileSystem,
logger
logger,
packageLockManager
);
GlobalContext.FailOnError = true;
bool result = applicationInstaller.Install(packageFolderPath, environmentSettings);
Expand All @@ -161,6 +169,7 @@ public void ReturnSuccessIfApplicationLogContainsSuccessMessage() {
var scriptExecutor = Substitute.For<ISqlScriptExecutor>();
var serviceUrlBuilder = Substitute.For<IServiceUrlBuilder>();
var logger = Substitute.For<ILogger>();
var packageLockManager = Substitute.For<IPackageLockManager>();
var clioFileSystem = new FileSystem(FileSystem);
var applicationLogProvider = Substitute.For<IApplicationLogProvider>();
applicationLogProvider.GetInstallationLog(Arg.Any<EnvironmentSettings>()).Returns("appLication InstallEd successfully");
Expand All @@ -172,7 +181,8 @@ public void ReturnSuccessIfApplicationLogContainsSuccessMessage() {
scriptExecutor,
serviceUrlBuilder,
clioFileSystem,
logger
logger,
packageLockManager
);
GlobalContext.FailOnError = true;
bool result = applicationInstaller.Install(packageFolderPath, environmentSettings);
Expand Down

0 comments on commit 7aa744a

Please sign in to comment.