1
+ # requires -Module ModuleBuilder
1
2
Describe " MoveUsingStatements" {
2
-
3
3
Context " Necessary Parameters" {
4
4
$CommandInfo = InModuleScope ModuleBuilder { Get-Command MoveUsingStatements }
5
5
@@ -96,7 +96,7 @@ Describe "MoveUsingStatements" {
96
96
$MoveUsingStatementsCmd = InModuleScope ModuleBuilder {
97
97
$null = Mock Write-Warning {}
98
98
$null = Mock Set-Content {}
99
- $null = Mock Write-Debug {} - ParameterFilter {$Message -eq " No Using Statement Error found." }
99
+ $null = Mock Write-Debug {} - ParameterFilter { $Message -eq " No using statement errors found." }
100
100
101
101
{ param ($RootModule )
102
102
ConvertToAst $RootModule | MoveUsingStatements
@@ -113,18 +113,17 @@ Describe "MoveUsingStatements" {
113
113
Assert-MockCalled - CommandName Set-Content - Times 0 - ModuleName ModuleBuilder
114
114
}
115
115
116
- It ' Should not do anything when there are no Using Statements Errors' {
117
-
116
+ It ' Should not do anything when there are no using statement errors' {
118
117
$testModuleFile = " $TestDrive \MyModule.psm1"
119
- $PSM1File = " Using namespace System.IO; function x {}"
118
+ $PSM1File = " using namespace System.IO; function x {}"
120
119
Set-Content $testModuleFile - value $PSM1File - Encoding UTF8
121
120
122
- & $MoveUsingStatementsCmd - RootModule $testModuleFile
121
+ & $MoveUsingStatementsCmd - RootModule $testModuleFile - Debug
123
122
124
- Assert-MockCalled - CommandName Write-Debug - Times 1 - ModuleName ModuleBuilder
125
- Assert-MockCalled - CommandName Set-Content - Times 0 - ModuleName ModuleBuilder
126
123
(Get-Content - Raw $testModuleFile ).Trim() | Should - Be $PSM1File
127
124
125
+ Assert-MockCalled - CommandName Set-Content - Times 0 - ModuleName ModuleBuilder
126
+ Assert-MockCalled - CommandName Write-Debug - Times 1 - ModuleName ModuleBuilder
128
127
}
129
128
130
129
0 commit comments