From a33a9f6f44d8beb6cfc15d4b56c1cb750ce4a06c Mon Sep 17 00:00:00 2001 From: OCram85 Date: Wed, 21 Mar 2018 14:03:44 +0100 Subject: [PATCH] adds pester test pipeline scenario --- tests/Item/02_New-CredentialStoreItem.Tests.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Item/02_New-CredentialStoreItem.Tests.ps1 b/tests/Item/02_New-CredentialStoreItem.Tests.ps1 index 6b711ef..9909e9d 100644 --- a/tests/Item/02_New-CredentialStoreItem.Tests.ps1 +++ b/tests/Item/02_New-CredentialStoreItem.Tests.ps1 @@ -98,5 +98,16 @@ Describe "New-CredentialStoreItem" { { New-CredentialStoreItem -Path 'C:\missingStore.json' -RemoteHost 'notrelevant' } | Should -Throw "Could not add anything" } } + Context "Testing pipeline paramter" { + It "Add the item with credential value from pipe" { + $UserName = 'pipeUser' + $Password = ConvertTo-SecureString -String "pipePasswd" -AsPlainText -Force + { [PSCredential]::new($UserName, $Password) | New-CredentialStoreItem -RemoteHost 'PipeHost' } | Should -Not -Throw + } + + It "Testing written item" { + (Get-CredentialStoreItem -RemoteHost 'PipeHost').UserName | Should -Be 'PipeHost' + } + } }