2018-02-13 09:23:53 -08:00
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
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
|
2018-03-23 10:36:11 -07:00
|
|
|
(Get-Module -Name $moduleName).Name | Should -BeExactly $moduleName
|
2016-03-17 23:50:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "should be able to remove a module with using Name switch" {
|
2018-03-23 10:36:11 -07:00
|
|
|
{ Remove-Module -Name $moduleName } | Should -Not -Throw
|
|
|
|
|
(Get-Module -Name $moduleName).Name | Should -BeNullOrEmpty
|
2016-03-17 23:50:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "should be able to remove a module with using ModuleInfo switch" {
|
|
|
|
|
$a = Get-Module -Name $moduleName
|
2018-03-23 10:36:11 -07:00
|
|
|
{ Remove-Module -ModuleInfo $a } | Should -Not -Throw
|
|
|
|
|
(Get-Module -Name $moduleName).Name | Should -BeNullOrEmpty
|
2016-03-17 23:50:23 -07:00
|
|
|
}
|
2017-01-16 13:31:14 -08:00
|
|
|
|
2016-03-17 23:50:23 -07:00
|
|
|
AfterEach {
|
|
|
|
|
Import-Module -Name $moduleName -Force
|
|
|
|
|
}
|
|
|
|
|
}
|