2016-07-25 14:01:41 -07:00
|
|
|
Describe "Remove-Module" -Tags "CI" {
|
2016-04-08 15:13:01 -07:00
|
|
|
$moduleName = "Microsoft.PowerShell.Security"
|
2017-01-16 13:31:14 -08:00
|
|
|
|
2016-03-17 23:50:23 -07:00
|
|
|
BeforeEach {
|
|
|
|
|
Import-Module -Name $moduleName -Force
|
2017-01-16 13:31:14 -08:00
|
|
|
(Get-Module -Name $moduleName).Name | Should be $moduleName
|
2016-03-17 23:50:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "should be able to remove a module with using Name switch" {
|
2017-01-16 13:31:14 -08:00
|
|
|
{ Remove-Module -Name $moduleName } | Should Not Throw
|
2016-03-17 23:50:23 -07:00
|
|
|
(Get-Module -Name $moduleName).Name | Should BeNullOrEmpty
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "should be able to remove a module with using ModuleInfo switch" {
|
|
|
|
|
$a = Get-Module -Name $moduleName
|
|
|
|
|
{ Remove-Module -ModuleInfo $a } | Should Not Throw
|
|
|
|
|
(Get-Module -Name $moduleName).Name | Should BeNullOrEmpty
|
|
|
|
|
}
|
2017-01-16 13:31:14 -08:00
|
|
|
|
2016-03-17 23:50:23 -07:00
|
|
|
AfterEach {
|
|
|
|
|
Import-Module -Name $moduleName -Force
|
|
|
|
|
}
|
|
|
|
|
}
|