From 4619d0d7baf7973197222eee74232c0f4ee9f0df Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 4 May 2016 10:25:04 -0700 Subject: [PATCH] Add tests for cmdlet example --- docs/cmdlet-example/SendGreeting.Tests.ps1 | 13 +++++++++++++ test/powershell/CmdletExample.Tests.ps1 | 6 ++++++ 2 files changed, 19 insertions(+) create mode 100644 docs/cmdlet-example/SendGreeting.Tests.ps1 create mode 100644 test/powershell/CmdletExample.Tests.ps1 diff --git a/docs/cmdlet-example/SendGreeting.Tests.ps1 b/docs/cmdlet-example/SendGreeting.Tests.ps1 new file mode 100644 index 000000000..2537d3fa6 --- /dev/null +++ b/docs/cmdlet-example/SendGreeting.Tests.ps1 @@ -0,0 +1,13 @@ +Describe "Send-Greeting cmdlet" { + It "Should be able build the cmdlet" { + Remove-Item -Recurse -Force bin -ErrorAction SilentlyContinue + dotnet restore --verbosity Error | Should BeNullOrEmpty + dotnet build | ?{ $_ -match "Compiling SendGreeting for .NETStandard,Version=v1.5" } | Should Not BeNullOrEmpty + } + + It "Should be able to use the module" { + Import-Module -ErrorAction Stop ./bin/Debug/netstandard1.5/SendGreeting.dll + Send-Greeting -Name World | Should Be "Hello World!" + Remove-Module SendGreeting + } +} diff --git a/test/powershell/CmdletExample.Tests.ps1 b/test/powershell/CmdletExample.Tests.ps1 new file mode 100644 index 000000000..449d850ee --- /dev/null +++ b/test/powershell/CmdletExample.Tests.ps1 @@ -0,0 +1,6 @@ +try { + Push-Location $PSScriptRoot/../../docs/cmdlet-example + ./SendGreeting.Tests.ps1 +} finally { + Pop-Location +}