File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,9 +6,6 @@ BeforeAll {
66
77 Remove-Module - Name $moduleName - Force - ErrorAction SilentlyContinue
88 Import-Module - Name " $modulePath \$moduleName " - Force
9-
10- # Create the dummy function for Linux systems
11- function Write-EventLog {}
129}
1310
1411Describe ' Write-ErrorLog' {
@@ -121,7 +118,7 @@ Describe 'Write-ErrorLog' {
121118
122119 # Arrange
123120 Start-ScriptLogger - Path (Join-Path - Path ' TestDrive:' - ChildPath ' test.log' ) - NoEventLog - NoConsoleOutput
124- $callerLine = 127
121+ $callerLine = 124
125122
126123 # Act
127124 Write-ErrorLog - Message ' My Error'
@@ -135,7 +132,7 @@ Describe 'Write-ErrorLog' {
135132
136133 # Arrange
137134 Start-ScriptLogger - Path (Join-Path - Path ' TestDrive:' - ChildPath ' test.log' ) - NoEventLog - NoConsoleOutput
138- $callerLine = 147
135+ $callerLine = 144
139136
140137 # Act
141138 try
@@ -156,7 +153,7 @@ Describe 'Write-ErrorLog' {
156153
157154 # Arrange
158155 Start-ScriptLogger - Path (Join-Path - Path ' TestDrive:' - ChildPath ' test.log' ) - NoEventLog - NoConsoleOutput
159- $callerLine = 168
156+ $callerLine = 165
160157
161158 # Act
162159 try
@@ -179,6 +176,8 @@ Describe 'Write-ErrorLog' {
179176
180177 BeforeAll {
181178
179+ function Write-EventLog {}
180+
182181 InModuleScope ' ScriptLogger' {
183182
184183 Mock ' Write-EventLog' - ModuleName ' ScriptLogger' - ParameterFilter { $LogName -eq ' Windows PowerShell' -and $Source -eq ' PowerShell' -and $entryType -eq ' Error' -and ($Message -like ' `[Write-ErrorLog.Tests.ps1:*`] My Error' -or $Message -like ' `[Write-ErrorLog.Tests.ps1:*`] Attempted to divide by zero. (RuntimeException: *Write-ErrorLog.Tests.ps1:* char:*)' ) } - Verifiable
You can’t perform that action at this time.
0 commit comments