DSInternals/Src/DSInternals.PowerShell/Tests/ConvertTo-UnicodePassword.Tests.ps1
2019-01-01 11:12:45 +01:00

20 lines
813 B
PowerShell

Describe "ConvertTo-UnicodePassword" {
Context "When correct input is provided" {
$testInput = ConvertTo-SecureString 'Pa$$w0rd' -AsPlainText -Force
$actual = ConvertTo-UnicodePassword $testInput
$expected = "UABhACQAJAB3ADAAcgBkAA=="
It "should return the correct base64 string" {
$actual | Should BeExactly $expected
}
}
Context "When the IsUnattendPassword switch is present" {
$testInput = ConvertTo-SecureString 'Pa$$w0rd' -AsPlainText -Force
$actual = ConvertTo-UnicodePassword $testInput -IsUnattendPassword
$expected = "UABhACQAJAB3ADAAcgBkAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA=="
It "should return the correct encrypted base64 string" {
$actual | Should BeExactly $expected
}
}
}