From 3956b8cd5baad0bd9241738dfea20fb3be8ff2a3 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Fri, 9 Oct 2015 10:51:23 -0700 Subject: [PATCH] added tests to ensure that powershell can interface with the dotnet api --- src/pester-tests/Test-DotNetAPI.Tests.ps1 | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/pester-tests/Test-DotNetAPI.Tests.ps1 diff --git a/src/pester-tests/Test-DotNetAPI.Tests.ps1 b/src/pester-tests/Test-DotNetAPI.Tests.ps1 new file mode 100644 index 0000000000..2f942d00be --- /dev/null +++ b/src/pester-tests/Test-DotNetAPI.Tests.ps1 @@ -0,0 +1,25 @@ +Describe "Test-DotNetAPI" { + $posh_E = 2.718281828459045 + $posh_pi = 3.14159265358979 + + It "Should be able to use static .NET classes and get a constant" { + [System.Math]::E | Should Match $posh_E.ToString() + [System.Math]::PI | Should Match $posh_pi.ToString() + } + + It "Should be able to invoke a method" { + [System.Environment]::GetEnvironmentVariable("PATH") | Should Be $env:PATH + } + + It "Should not require 'system' in front of static classes" { + [Environment]::CommandLine | Should Be ([System.Environment]::CommandLine) + + [Math]::E | Should Be ([System.Math]::E) + } + + It "Should be able to create a new instance of a .Net object" { + [System.Guid]$guidVal = [System.Guid]::NewGuid() + + $guidVal.GetType().Name | Should Be "Guid" + } +}