@@ -20,16 +20,20 @@ InModuleScope -ModuleName OutSystems.SetupTools {
2020 Mock GetServerSerialNumber { return ' XBI-NMO-IL5-OYI-9SO-LCU-4SQ-QUT' }
2121 Mock Test-Path { return $true }
2222 Mock Get-Content { return $filecontent }
23+ Mock GetLifetimeVersion { return $null }
2324
2425 $assGetServerInstallDir = @ { ' CommandName' = ' GetServerInstallDir' ; ' Times' = 1 ; ' Exactly' = $true ; ' Scope' = ' Context' }
2526 $assGetServerVersion = @ { ' CommandName' = ' GetServerVersion' ; ' Times' = 1 ; ' Exactly' = $true ; ' Scope' = ' Context' }
2627 $assGetServerMachineName = @ { ' CommandName' = ' GetServerMachineName' ; ' Times' = 1 ; ' Exactly' = $true ; ' Scope' = ' Context' }
2728 $assGetServerSerialNumber = @ { ' CommandName' = ' GetServerSerialNumber' ; ' Times' = 1 ; ' Exactly' = $true ; ' Scope' = ' Context' }
29+ $assGetLifetimeVersion = @ { ' CommandName' = ' GetLifetimeVersion' ; ' Times' = 1 ; ' Exactly' = $true ; ' Scope' = ' Context' }
30+
2831
2932 $assNotGetServerInstallDir = @ { ' CommandName' = ' GetServerInstallDir' ; ' Times' = 0 ; ' Exactly' = $true ; ' Scope' = ' Context' }
3033 $assNotGetServerVersion = @ { ' CommandName' = ' GetServerVersion' ; ' Times' = 0 ; ' Exactly' = $true ; ' Scope' = ' Context' }
3134 $assNotGetServerMachineName = @ { ' CommandName' = ' GetServerMachineName' ; ' Times' = 0 ; ' Exactly' = $true ; ' Scope' = ' Context' }
3235 $assNotGetServerSerialNumber = @ { ' CommandName' = ' GetServerSerialNumber' ; ' Times' = 0 ; ' Exactly' = $true ; ' Scope' = ' Context' }
36+ $assNotGetLifetimeVersion = @ { ' CommandName' = ' GetLifetimeVersion' ; ' Times' = 0 ; ' Exactly' = $true ; ' Scope' = ' Context' }
3337
3438 Context ' When platform is not installed' {
3539
@@ -41,6 +45,7 @@ InModuleScope -ModuleName OutSystems.SetupTools {
4145 It ' Should call the GetServerVersion' { Assert-MockCalled @assGetServerVersion }
4246 It ' Should not call the GetServerMachineName' { Assert-MockCalled @assNotGetServerMachineName }
4347 It ' Should not call the GetServerSerialNumber' { Assert-MockCalled @assNotGetServerSerialNumber }
48+ It ' Should not call the GetLifetimeVersion' { Assert-MockCalled @assNotGetLifetimeVersion }
4449 It ' Should output an error' { $err [-1 ] | Should Be ' Outsystems platform is not installed' }
4550 It ' Should not throw' { { Get-OSServerInfo - ErrorAction SilentlyContinue } | Should Not throw }
4651 }
@@ -54,33 +59,25 @@ InModuleScope -ModuleName OutSystems.SetupTools {
5459 It ' Should return the correct machine name' { $output.MachineName | Should Be ' MYMACHINE' }
5560 It ' Should return the correct serial number' { $output.SerialNumber | Should Be ' XBI-NMO-IL5-OYI-9SO-LCU-4SQ-QUT' }
5661 It ' Should return the correct private key' { $output.PrivateKey | Should Be ' v4iwANAsGDRpjiEpO8Kt3Q==' }
62+ It ' Should return the correct lifetime version' { $output.LifetimeVersion | Should Be $null }
5763 It ' Should output a version type property' { ($output.Version ).GetType().Name | Should Be ' Version' }
5864 It ' Should call the GetServerInstallDir' { Assert-MockCalled @assGetServerInstallDir }
5965 It ' Should call the GetServerVersion' { Assert-MockCalled @assGetServerVersion }
6066 It ' Should call the GetServerMachineName' { Assert-MockCalled @assGetServerMachineName }
6167 It ' Should call the GetServerSerialNumber' { Assert-MockCalled @assGetServerSerialNumber }
68+ It ' Should call the GetLifetimeVersion' { Assert-MockCalled @assGetLifetimeVersion }
6269 It ' Should not output an error' { $err.Count | Should Be 0 }
6370 It ' Should not throw' { { Get-OSServerInfo - ErrorAction SilentlyContinue } | Should Not throw }
6471 }
6572
66- Context ' When the platform server is installed but NOT configured ' {
73+ Context ' When lifetime is installed' {
6774
68- Mock GetServerMachineName { return $null }
69- Mock GetServerSerialNumber { return $null }
70- Mock Test-Path { return $false }
75+ Mock GetLifetimeVersion { return ' 11.0.0.1' }
7176
7277 $output = Get-OSServerInfo - ErrorAction SilentlyContinue - ErrorVariable err
7378
74- It ' Should return the correct install directory' { $output.InstallDir | Should Be ' C:\Program Files\OutSystems\Platform Server' }
75- It ' Should return the correct server version' { $output.Version | Should Be ' 11.0.0.0' }
76- It ' Should return an empty machine name' { $output.MachineName | Should Be $null }
77- It ' Should return an empty serial number' { $output.SerialNumber | Should Be $null }
78- It ' Should return an empty private key' { $output.PrivateKey | Should Be ' ' }
79- It ' Should output a version type property' { ($output.Version ).GetType().Name | Should Be ' Version' }
80- It ' Should call the GetServerInstallDir' { Assert-MockCalled @assGetServerInstallDir }
81- It ' Should call the GetServerVersion' { Assert-MockCalled @assGetServerVersion }
82- It ' Should call the GetServerMachineName' { Assert-MockCalled @assGetServerMachineName }
83- It ' Should call the GetServerSerialNumber' { Assert-MockCalled @assGetServerSerialNumber }
79+ It ' Should return the correct server version' { $output.LifetimeVersion | Should Be ' 11.0.0.1' }
80+ It ' Should output a version type property for lifetime' { ($output.LifetimeVersion ).GetType().Name | Should Be ' Version' }
8481 It ' Should not output an error' { $err.Count | Should Be 0 }
8582 It ' Should not throw' { { Get-OSServerInfo - ErrorAction SilentlyContinue } | Should Not throw }
8683 }
0 commit comments