Files
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Core/Remove-Module.Tests.ps1
T

25 lines
859 B
PowerShell
Raw Normal View History

# 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
(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" {
{ 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
{ 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
}
}