181 Commits

Author SHA1 Message Date
Wes Carroll 5613b97eef Merge pull request #79 from ZertoPublic/PrepRelease
Release Update
2020-05-06 13:00:52 -04:00
Wes Carroll 3a2e8f4ee7 Bump Version 2020-05-06 12:45:09 -04:00
Wes Carroll 380ac5c841 Move Recent Updates to ChangeLog 2020-05-06 12:44:58 -04:00
Wes Carroll c2a0ac9fa0 Update CHANGELOG for Release 2020-05-06 12:44:32 -04:00
Wes Carroll ba2bed6b53 Merge pull request #78 from ZertoPublic/Update-Function-Tests
Update function tests
2020-05-06 09:56:01 -04:00
Wes Carroll 5ec0ddce62 Add general Changes to Changelog 2020-05-06 08:24:28 -04:00
Wes Carroll 83f00e00ee Update the Version Pattern 2020-05-06 08:17:26 -04:00
Wes Carroll 63a1ab928e Update builtfiletests to ensure module is built 2020-05-05 22:13:54 -04:00
Wes Carroll e6ead11891 Update mandatory parameter declaration 2020-05-05 21:59:14 -04:00
Wes Carroll aecd4fd1d5 Updated CHANGELOG with formatting information 2020-05-05 21:25:54 -04:00
Wes Carroll 8dcee4068a Update PSSA Rules for New PSSA Version 2020-05-05 16:30:49 -04:00
Wes Carroll b0d68ea224 Updete to use process block for pipeline 2020-05-05 16:29:56 -04:00
Wes Carroll 22b0da87b9 Update to latest versions of modules 2020-05-05 14:35:29 -04:00
Wes Carroll fc3c08637b Module Release Notes point to GitHub 2020-05-05 14:32:13 -04:00
Wes Carroll 4894084292 Remove RELEASENOTES for CHANGELOG 2020-05-05 14:27:27 -04:00
Wes Carroll 781368398c Update release notes to point to CHANGELOG 2020-05-05 14:26:41 -04:00
Wes Carroll 4271afd5b4 Move historical Release Notes to ChangeLog 2020-05-05 14:11:49 -04:00
Wes Carroll 6c2b029014 Update Parameter Name to work with filter 2020-05-05 13:47:19 -04:00
Wes Carroll e47458b2df Update ReleaseNotes to maintain history 2020-04-30 11:53:55 -04:00
Wes Carroll d38f206824 Update ZVM Headers 2020-04-30 11:11:29 -04:00
Wes Carroll ed6024fe63 Add Tests for Password Update
# Conflicts:
#	Tests/Public/Edit-ZertoVra.Tests.ps1
2020-04-20 17:21:52 -04:00
Wes Carroll 8b213ede25 Merge pull request #77 from ZertoPublic/Pester5Prep
Pester 5 prep
2020-04-20 17:00:00 -04:00
Wes Carroll 6620246e4c Update Method to Grab Path
https://jakubjares.com/2020/04/11/pester5-importing-ps-files/
2020-04-20 16:35:02 -04:00
Wes Carroll 71610ce9fe Pin Pester v4 2020-04-20 16:28:19 -04:00
Wes Carroll fb45693fb1 Pester 5 Prep 2020-04-20 16:28:03 -04:00
Wes Carroll 8578c775dd Merge pull request #76 from ZertoPublic/Refactor-Copy-ZertoVpg
Refactor Copy-ZertoVpg and Add Tests
2020-04-20 16:19:54 -04:00
Wes Carroll b186c561e6 Start of Next Releasenotes 2020-04-20 16:14:41 -04:00
Wes Carroll ae6a80b48d Merge branch 'master' into Refactor-Copy-ZertoVpg 2020-04-20 15:50:13 -04:00
Wes Carroll 9fafe4b58b Make PowerShell Gallery Badge Clickable 2020-04-20 15:34:07 -04:00
Wes Carroll c1b7c490ff Create Function Tests 2020-04-20 15:33:17 -04:00
Wes Carroll 589a3b7d6e Create Mock Data for Tests 2020-04-20 15:33:12 -04:00
Wes Carroll 9913c96d65 Refactor Function 2020-04-20 15:33:05 -04:00
Wes Carroll fe4d8cf4dd Merge pull request #75 from ZertoPublic/ReleasePrep
April Release
2020-04-10 08:14:00 -04:00
Wes Carroll e35939e592 Bump Version 2020-04-09 14:37:38 -04:00
Wes Carroll c422e26903 Update Readme for release 2020-04-09 14:37:27 -04:00
Wes Carroll e37444249e Merge pull request #74 from ZertoPublic/VirtulizationSiteRepos
Add functionality for ZVM 8.0
2020-04-09 13:27:35 -04:00
Wes Carroll 616cdcf7a2 Update Tests for WindowPS 2020-04-09 13:22:57 -04:00
Wes Carroll e7658fcfec Update the version of Pester to latest version 2020-04-09 13:22:42 -04:00
Wes Carroll a306391a14 Fix Filename Case 2020-04-09 12:55:41 -04:00
Wes Carroll 83e9551692 Add tests for function 2020-04-09 12:48:33 -04:00
Wes Carroll 7fbc550390 Add Mocks for Tests 2020-04-09 12:48:04 -04:00
Wes Carroll e3cba682c7 DRY Refactor 2020-04-09 10:37:36 -04:00
Wes Carroll 96b3e65be2 Update RELEASENOTES.md 2020-04-08 15:26:10 -04:00
Wes Carroll d15111a883 Add new LTR API Endpoint
Added new LTR endpoint and help messages to indicate that it will only work with Version 8.0 and above. Also updated help message for backup settings indicating that backup settings only work with 7.5 and below.
2020-04-08 15:19:46 -04:00
Wes Carroll 90434b56a2 Updated for new Repositories endpoint 2020-04-07 17:35:55 -04:00
Wes Carroll 85e60adac1 Merge pull request #73 from ZertoPublic/UpdateServiceAccountPassword
Create function to Update service account password
2020-04-07 10:44:00 -04:00
Wes Carroll 0d6bc39c86 Add an additional example 2020-04-07 10:30:42 -04:00
Wes Carroll ad2073f404 Fixed submitted body formatting 2020-04-07 10:27:22 -04:00
Wes Carroll e12bf9d85e Fix script level variable 2020-04-07 10:18:37 -04:00
Wes Carroll a5f3ad4de0 Update RELEASENOTES.md 2020-04-07 10:05:34 -04:00
Wes Carroll 77fb3c8f67 Fix helpmessage typo 2020-04-07 10:05:31 -04:00
Wes Carroll b2e5fe7b5c Update Set-ZertoUserCredential.md 2020-04-07 10:04:55 -04:00
Wes Carroll f34f21bb85 Create Set-ZertoUserCredential.md 2020-04-07 07:49:13 -04:00
Wes Carroll 536a62f792 Create Set-ZertoUserCredential.Tests.ps1 2020-04-06 17:15:57 -04:00
Wes Carroll df83277c06 Create Set-ZertoUserCredential.ps1 2020-04-06 17:15:52 -04:00
Wes Carroll d55bc3e4b3 Merge branch 'UpdateVraWithPassword' 2020-04-04 10:42:56 -04:00
Wes Carroll 7488e7999f Updated Release notes with current changes 2020-04-04 10:36:51 -04:00
Wes Carroll dcba2b04a9 Added Edit Password Information 2020-04-04 10:30:46 -04:00
Wes Carroll bd94bfe5db Update Help Files 2020-04-04 10:26:56 -04:00
Wes Carroll fb722661a7 Update Edit-ZertoVra.Tests.ps1 2020-04-03 16:51:09 -04:00
Wes Carroll 6121940563 Added ability to updated Host Password 2020-04-03 10:35:44 -04:00
Wes Carroll 64fa03e4ea Merge pull request #71 from ZertoPublic/ZA-Planner
Updates for Zerto Analytics
2020-04-02 19:57:38 -04:00
Wes Carroll 86854442ef Update Online Link to Help 2020-04-02 17:56:57 -04:00
Wes Carroll bc46a512cd Update RELEASENOTES.md 2020-04-02 17:55:04 -04:00
Wes Carroll 0a84246d8e Add parameter validation 2020-04-02 17:44:16 -04:00
Wes Carroll f299aecb9b Add parameter validation 2020-04-02 17:44:00 -04:00
Wes Carroll 646476e74e Remove unused parameter 2020-04-02 17:43:50 -04:00
Wes Carroll 285a82f280 Fix Parameter Test 2020-04-02 17:43:39 -04:00
Wes Carroll fbe9fb2af8 Fix Parameter Test 2020-04-02 17:43:28 -04:00
Wes Carroll 1af70b8c80 Create Tests 2020-04-02 17:38:35 -04:00
Wes Carroll 0ef71c25bb Update Get-ZAPlannerZcasReport.md 2020-04-02 17:16:14 -04:00
Wes Carroll 78e1cdb981 Update Get-ZAPlannerWanReport.md 2020-04-02 17:16:11 -04:00
Wes Carroll 1a66d4e64b Update Get-ZAPlannerStatsReport.md 2020-04-02 17:09:25 -04:00
Wes Carroll 2fef1dbc42 Create Get-ZAProtectedVmReport.md 2020-04-02 16:46:59 -04:00
Wes Carroll b00ededc7f Create Get-ZAProtectedVm.md 2020-04-02 16:44:08 -04:00
Wes Carroll 8e5ced9b87 Create Get-ZAProtectedVmReport.ps1 2020-04-02 15:12:52 -04:00
Wes Carroll 69fb384c89 Create Get-ZAProtectedVm.ps1 2020-04-02 15:12:43 -04:00
Wes Carroll a8b9ec3a00 Update Help File Formatting 2020-04-02 15:12:04 -04:00
Wes Carroll 355be7c1e5 Merge branch 'master' into ZA-Planner 2020-04-02 12:30:58 -04:00
Wes Carroll c94f04de77 Merge pull request #69 from ZertoPublic/MultiClusterSingleDatastore
Updates to Install-ZertoVra
2020-04-02 12:29:36 -04:00
Wes Carroll f4807f94fb Merge branch 'master' into MultiClusterSingleDatastore 2020-04-02 12:25:25 -04:00
Wes Carroll d39777cbb0 Merge pull request #70 from ZertoPublic/AzurePipelinesUpdates
Update build agents.
2020-04-02 12:22:14 -04:00
Wes Carroll 8b43856558 Update build agents. 2020-04-02 12:17:55 -04:00
Wes Carroll 83879a51e7 Update RELEASENOTES.md 2020-04-02 11:54:48 -04:00
Wes Carroll 2d1fb8e4db Update Install-ZertoVra.md 2020-04-02 10:51:05 -04:00
Wes Carroll e774cd861d Update Copy-ZertoVpg.md 2020-04-02 10:48:19 -04:00
Wes Carroll a660aa29b3 Update Common Parameters formatting 2020-04-02 10:48:02 -04:00
Wes Carroll 82458712f0 Update tests for new functionality 2020-04-02 10:46:40 -04:00
Wes Carroll bae9eb9b99 Update function to enable password installation 2020-04-02 10:27:20 -04:00
Wes Carroll 2ea7092b91 Update logic to only allow install to attached devices 2020-04-01 17:14:21 -04:00
Wes Carroll de08f0eece Ensure the right DSId is mapped to the target host. 2020-03-19 17:08:08 -04:00
Wes Carroll 3e980dc195 Add Online Help URI 2020-03-19 16:25:28 -04:00
Wes Carroll eccc5f27f3 Update Get-ZAPlannerNetworkPerformanceReport.md 2020-03-19 09:21:05 -04:00
Wes Carroll e516a24e38 Update Get-ZAPlannerJournalSizeReport.md 2020-03-19 09:19:48 -04:00
Wes Carroll 07f92583f8 Update Single Site URL 2020-03-18 13:57:12 -04:00
Wes Carroll c2f554dca1 Update Get-ZAPlannerSite.md 2020-03-18 13:54:58 -04:00
Wes Carroll 8bd865d83d Create Template Help Files 2020-03-08 22:45:51 -04:00
Wes Carroll 02e50d9cd6 Create Get-ZAPlannerZcasReport.ps1 2020-03-08 17:33:36 -04:00
Wes Carroll 7fc0a5f579 Create Get-ZAPlannerWanReport.ps1 2020-03-08 17:33:31 -04:00
Wes Carroll ce5a64c683 Create Get-ZAPlannerNetworkPerformanceReport.ps1 2020-03-08 17:33:27 -04:00
Wes Carroll 1317a6c039 Create Get-ZAPlannerJournalSizeReport.ps1 2020-03-08 17:33:24 -04:00
Wes Carroll 169e628c7b Remove Debugging Output 2020-03-08 14:57:19 -04:00
Wes Carroll d35d9d7cf4 Create Get-ZAPlannerStatsReport.ps1 2020-03-08 14:40:22 -04:00
Wes Carroll a891a4914d Create Get-ZAPlannerSite.ps1 2020-03-08 14:39:34 -04:00
Wes Carroll 71352cae7b Merge pull request #68 from ZertoPublic/IZRR-to-public
Move RestRequest functions into Public
2020-03-06 17:22:53 -05:00
Wes Carroll b0edd9026f Update RELEASENOTES.md 2020-03-06 14:08:12 -05:00
Wes Carroll 7cde687d70 Create Documentation for Newly Public Functions 2020-03-06 13:42:58 -05:00
Wes Carroll 569d9e264c Update ZertoRestRequest and associated Tests 2020-03-06 13:42:39 -05:00
Wes Carroll 40331c26f9 Update ZARestRequest and associated tests. 2020-03-06 13:42:20 -05:00
Wes Carroll 526093afc6 Fix the Tests extension 2020-03-06 13:31:59 -05:00
Wes Carroll dc4dd1ad05 Move IZRR function to public 2020-03-06 10:40:21 -05:00
Wes Carroll 779ee1415e Move IZRR to public 2020-03-06 10:38:41 -05:00
Wes Carroll 13592df6aa Move ZARestRequest to Public Function 2020-03-06 10:33:12 -05:00
Wes Carroll fad3ca0e27 Update RELEASENOTES.md 2020-03-06 10:01:17 -05:00
Wes Carroll 52782aa1e5 Merge pull request #67 from ZertoPublic/Refactor-GetVpg
Refactor Get-ZertoVpg
2020-03-06 09:11:10 -05:00
Wes Carroll bc02e796d6 Refactor for DRY 2020-03-05 21:43:52 -05:00
Wes Carroll 4c32bbe057 Update to PwSh Version 7 2020-03-05 21:43:32 -05:00
Wes Carroll cc9e53ac44 Merge branch 'fix-typos' 2020-03-02 10:30:12 -05:00
Wes Carroll 37165e18a7 Typo Correction Update 2020-03-02 10:00:45 -05:00
Wes Carroll 772848beef Updated help file to reflect typo correction 2020-03-02 09:53:55 -05:00
Wes Carroll 18185612bb Fixed recovery switch typo 2020-03-02 09:51:23 -05:00
Wes Carroll ecab2500c7 Merge pull request #65 from ZertoPublic/checkpoint-refactor
Checkpoint refactor
2020-03-02 09:46:34 -05:00
Wes Carroll fde7f67e45 Update RELEASENOTES.md 2020-03-02 09:41:09 -05:00
Wes Carroll e19f9b34f5 Update function to allow pipeline operations 2020-02-28 08:15:53 -05:00
Wes Carroll a36a7cb37a Cleanup documentation 2020-02-28 08:15:15 -05:00
Wes Carroll 1e80bb06fb Merge pull request #63 from ZertoPublic/ExportNicUpdate
Update Export and Import VpgNicSetting functions
2019-12-22 11:01:27 -05:00
Wes Carroll 4c98b75134 Update RELEASENOTES.md 2019-12-22 10:48:07 -05:00
Wes Carroll a7efc7c717 Merge branch 'master' into ExportNicUpdate 2019-12-22 10:37:44 -05:00
Wes Carroll 02f1c89d86 Merge pull request #62 from ZertoPublic/RecoveryReport
Remove -VpgIdentifier Parameter from Get-ZertoRecoveryReport function
2019-12-22 10:35:35 -05:00
Wes Carroll 5b9243a02f Updated releasenotes with changes 2019-12-22 10:16:27 -05:00
Wes Carroll 1962dda15c Remove vpgIdentifier Parameter
vpgIdentifier Parameter as added as a parameter by mistake. The API does not accecpt this as a filter.
2019-12-22 10:07:17 -05:00
Wes Carroll 801553178e Update Online Help Link 2019-12-20 22:56:20 -05:00
Wes Carroll 6c92dff447 Update Description with new logic 2019-12-20 22:56:04 -05:00
Wes Carroll 003396998c Eliminate Blank Output 2019-12-20 21:09:12 -05:00
Wes Carroll 05783a1f37 Update Import Logic 2019-12-19 18:49:13 -05:00
Wes Carroll 270470f858 Update Nic Object Logic 2019-12-18 13:06:11 -05:00
Wes Carroll 579ba7a063 Merge pull request #59 from ZertoPublic/PrepRelease
Prep release
2019-12-01 17:15:24 -05:00
Wes Carroll 2cb35165a9 Update README 2019-12-01 17:09:57 -05:00
Wes Carroll 82cf4cb732 Bump Version for Release 2019-12-01 17:05:53 -05:00
Wes Carroll 9d21eb6409 Format Release Notes 2019-12-01 17:05:40 -05:00
Wes Carroll abadc86ae8 Merge pull request #58 from ZertoPublic/FoT-Fix
Fixes Failover Test function
2019-12-01 17:01:53 -05:00
Wes Carroll f094263882 Update RELEASENOTES.md 2019-11-28 10:55:59 -05:00
Wes Carroll c47614727a Fix Verbose Typo 2019-11-28 10:41:26 -05:00
Wes Carroll 7cad7eaf75 Merge pull request #56 from ZertoPublic/CopyVpgBugFix
Fix Bug when Adding Additional VMs
2019-11-08 08:32:13 -05:00
Wes Carroll d6862f75d1 Fix Bug when Adding Additional VMs 2019-11-07 22:35:40 -05:00
Wes Carroll 5b8a89e1a3 Merge pull request #55 from ZertoPublic/CloneVPG
Implement Clone VPG Function
2019-11-07 21:45:27 -05:00
Wes Carroll d6562de9bf Update for Copy-ZertoVpg 2019-11-07 21:37:03 -05:00
Wes Carroll cdae203993 Fix Documentation Formatting 2019-11-07 17:44:06 -05:00
Wes Carroll 213b6029e4 Create Documentation 2019-11-07 17:43:40 -05:00
Wes Carroll 11ab03be0a Create Tests 2019-11-07 17:43:29 -05:00
Wes Carroll 5f978d7b1a Fix AddVM Logic 2019-11-07 17:43:18 -05:00
Wes Carroll 5c76c4c58c Merge pull request #53 from ZertoPublic/wcarroll-patch-1
Update Connect-ZertoServer.md
2019-11-04 16:20:49 -05:00
Wes Carroll 8b3a3b3b0b Update Connect-ZertoServer.md 2019-11-04 16:20:31 -05:00
Wes Carroll 63d56cf862 Merge branch 'CloneVPG' of https://github.com/wcarroll/ZertoApiWrapper into CloneVPG 2019-10-25 14:10:09 -04:00
Wes Carroll 10785df8a9 Create Copy-ZertoVpg Function 2019-10-25 14:09:00 -04:00
Wes Carroll 8a1593ceba Merge pull request #52 from ZertoPublic/EvacuateHost
Implement Evacuate VRA Function
2019-10-25 14:03:26 -04:00
Wes Carroll 1ca3d6704b Update Release Notes for Evacuate Function 2019-10-25 13:49:59 -04:00
Wes Carroll b4a7df970c Correct VraIdentifier Property 2019-10-24 13:51:26 -04:00
Wes Carroll 3d8acf03f6 Update Tests to include set counts 2019-10-24 13:50:52 -04:00
Wes Carroll 07de073bf1 Create Invoke-ZertoEvacuateVra.Tests.ps1 2019-10-24 07:25:38 -04:00
Wes Carroll 7641d28307 Add parameter validation 2019-10-23 10:00:42 -04:00
Wes Carroll 30422d0421 Create Invoke-ZertoEvacuateVra.md 2019-10-23 09:52:09 -04:00
Wes Carroll 4a0885f731 Fix Help Message Typo 2019-10-22 13:35:49 -04:00
Wes Carroll 28d66806a5 Add ExternalHelp Def 2019-10-22 13:31:10 -04:00
Wes Carroll 42b923cef5 Create EvacuateVra Function 2019-10-22 13:26:10 -04:00
Wes Carroll 5984bc93c9 Create Copy-ZertoVpg Function 2019-10-12 22:26:13 -04:00
Wes Carroll 528bc66bcd Merge pull request #49 from ZertoPublic/New-Token
Add Function to Obtain a Pairing Token
2019-10-08 12:45:15 -04:00
Wes Carroll e706470395 Add New-ZertoPairingToken to Release notes. 2019-10-08 12:37:11 -04:00
Wes Carroll 29a79bbb92 Correct extension case. 2019-10-08 12:31:34 -04:00
Wes Carroll f907acd14a Create New-ZertoPairingToken.md 2019-10-07 11:23:24 -04:00
Wes Carroll 90a17045af Create PairingToken.Json 2019-10-07 11:23:19 -04:00
Wes Carroll e1ba8412ff Create New-ZertoPairingToken.Tests.ps1 2019-10-07 11:23:13 -04:00
Wes Carroll 0a90d51735 Create New-ZertoPairingToken.ps1 2019-10-07 11:23:10 -04:00
Wes Carroll 9d34086e40 Merge pull request #48 from ZertoPublic/75Update
Update to add token parameter to Add-ZertoPeerSite
2019-10-04 17:01:37 -04:00
Wes Carroll 842c7ceeec Added release notes for this update. 2019-10-03 16:54:56 -04:00
Wes Carroll d78fc28b1c Add ShouldProcess support to help file. 2019-10-03 14:33:17 -04:00
Wes Carroll 28fb42d56a Update documentation for token parameter and example. 2019-10-03 14:33:01 -04:00
Wes Carroll 0657607f3a Update Tests to New format and add token parameter tests 2019-10-03 14:32:36 -04:00
Wes Carroll 32f6a6eebc Update function to use new token parameter 2019-10-03 14:32:05 -04:00
Wes Carroll 6cc2e8d61d Correct Example Number Typo 2019-09-04 15:45:17 -04:00
Wes Carroll b9598e7e0b Add Aug Release in recent updates. 2019-08-01 14:11:59 -04:00
256 changed files with 9389 additions and 5443 deletions
+1 -1
View File
@@ -4,5 +4,5 @@
"editor.insertSpaces": true, "editor.insertSpaces": true,
"editor.tabSize": 4, "editor.tabSize": 4,
"powershell.codeFormatting.preset": "OTBS", "powershell.codeFormatting.preset": "OTBS",
"terminal.integrated.shell.windows": "c:/Program Files/PowerShell/6/pwsh.exe" "terminal.integrated.shell.windows": "c:/Program Files/PowerShell/7/pwsh.exe"
} }
+91
View File
@@ -0,0 +1,91 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.4.1]
### General
* Removed RELEASENOTES and converted to a CHANGELOG format.
* Updated the build process to follow Semantic Versioning.
* Updated the build process to use the latest Pester Version (4.10.1)
* Updated the build process to use the latest PS Script Analyzer Version (1.19.0)
* Updated the Tests Files to use a more modern method of grabbing the PSScriptPath
### Zerto Virtual Manager
* Refactored `Copy-ZertoVpg` functionality to leverage identifier and name maps and eliminate `where-object` searches.
* Updated `Get-ZertoEvent` parameter to fall in line with the filter parameter name in the API documentation. Moved the old parameter name to an alias to ensure that existing functionality continues to work.
## [1.4.0.20200410]
### Zerto Virtual Manager
* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/60) in the `Get-ZertoRecoveryReport` function where the `-VpgIdentifier` parameter was not working. This parameter is not accepted by the API as a valid filter and is ignored. This parameter has been removed from the function.
* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/61) where the `Export-ZertoVpgNicSetting` function would not properly execute when run against a VM with no NICs attached.
* In reviewing the `Export-ZertoVpgNicSetting`, a review of the `Import-ZertoVpgNicSetting` was completed and it was determined to update the import logic based on various test cases. Along with this, it is now possible to reset the NIC settings to the default state with the `Import-ZertoVpgNicSetting` command. Please review the [Import-ZertoVpgNicSetting help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVmNicSetting.md) to review the updated options and import logic.
* Refactored the `Checkpoint-ZertoVpg` command to allow pipeline input (ByValue and ByProperty) for the VpgName parameter.
* Corrected a parameter typo in the `Get-ZertoVpgSetting` function. The misspelt parameter was added as an alias to ensure any existing scripts using the parameter continue to function.
* Refactored the `Get-ZertoVpg` command to remove repetitive commands and variables that are no longer required.
* Moved `Invoke-ZertoRestRequest` and `Invoke-ZARestRequest` to be public functions. As there become more and more scenarios where there are not prebuilt functions to accomplish complex specialized tasks, it became apparent that these functions could be leveraged to make the experience and workflow easier.
* Updated the `Install-ZertoVra` logic to ensure that the target datastore is available on the target host. There isn't currently any method to validate the target network, but if that becomes available in a later version of the API, the function will be updated.
* Updated the `Install-ZertoVra` function to allow for installation of the VRA using the host password method. Please review the [Install-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) documentation for syntax and examples.
* Updated the `Edit-ZertoVra` function to allow for modification of the associated ESX host password if the need arises. Please review the [Edit-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md) documentation for syntax and examples.
* Added a new function, `Set-ZertoUserCredential`, to allow the updating of the username and password used to connect the Zerto Virtual Manager to the paired hypervisor. Please see the [Set-ZertoUserCredential](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoUserCredential.md) help for additional information.
* With the release of [Zerto 8.0](https://www.zerto.com/zerto-8-0-general-availability/) some additional API endpoints have become available.
* Updated `Get-ZertoVirtualizationSite` to add the `-repository` parameter to enable returning information for LTR repositories.
* Updated `Get-ZertoVpgSetting` to add the `-ltr` parameter to enable returning information for current LTR settings for the selected VPG.
### Zerto Analytics
* Added several functions for the newly added [Zerto Analytics](https://analytics.zerto.com) Planner.
* `Get-ZAPlannerSite` Help can be found here: [Get-ZAPlannerSite](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerSite.md)
* `Get-ZAPlannerStatsReport` Help can be found here: [Get-ZAPlannerStatsReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerStatsReport.md)
* `Get-ZAPlannerJournalSizeReport` Help can be found here: [Get-ZAPlannerJournalSizeReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerJournalSizeReport.md)
* `Get-ZAPlannerNetworkPerformanceReport` Help can be found here: [Get-ZAPlannerNetworkPerformanceReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerNetworkPerformanceReport.md)
* `Get-ZAPlannerWanReport` Help can be found here: [Get-ZAPlannerWanReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerWanReport.md)
* `Get-ZAPlannerZcasReport` Help can be found here: [Get-ZAPlannerZcasReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerZcasReport.md)
* Created `Get-ZAProtectedVm` and `Get-ZAProtectedVmReport` functions to leverage the newly released Zerto Analytics APIs for this data. Help files can be found here: [Get-ZAProtectedVm](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVm.md) and [Get-ZAProtectedVmReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVmReport.md)
## [1.3.0.20191201]
### Zerto Virtual Manager
* [Zerto version 7.5 has been released.](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Release%20Notes.pdf) As part of this release Zerto has added API functionality that requires the following updates.
* A token is now required to pair two sites together. The need is discussed in [Issue 46](https://github.com/ZertoPublic/ZertoApiWrapper/issues/46). To implement this change a `-token` parameter has been added to the `Add-ZertoPeerSite` function.
* A new function has been added; `New-ZertoPairingToken`. This function will allow users to generate a pairing authentication token from the target ZVM to be used in the pairing process. [Issue 47](https://github.com/ZertoPublic/ZertoApiWrapper/issues/47) covers additional details.
* A new function has been added; `Invoke-ZertoEvacuateVra`. This function will allow users to evacuate a target VRA by specifying a Host Name, VRA Name, or VRA Identifier. All VMs currently replicating to the specified location will be migrated to different targets. [Issue 51](https://github.com/ZertoPublic/ZertoApiWrapper/issues/51)
* A function has been added; `Copy-ZertoVpg`. This function will allow users to copy the settings of a single VPG and add new VMs to it. There is currently no customization beyond specifying the VMs to be placed in the newly created VPG. Should additional edits \ updates be required, they should be done post creation. [Issue 54](https://github.com/ZertoPublic/ZertoApiWrapper/issues/54)
* Fixed [issue 57](https://github.com/ZertoPublic/ZertoApiWrapper/issues/57) where a `Start-ZertoFailoverTest` would throw an error complaining about validating the body parameter. This has been fixed and tested against Zerto Virtual Manager 7.5 Update 1 with Windows PowerShell 5.1 and PowerShell Core 6.2.
## [1.2.0.20190801]
### Zerto Virtual Manager
* Added two functions to aid in bulk updating of NIC information for protected VMs. ([Issue 38](https://github.com/ZertoPublic/ZertoApiWrapper/issues/38))
* [Export-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVmNicSettings.md)
* [Import-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVmNicSettings.md)
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/43) where a VPG being created with a single VM member would not be parsed by the API correctly using PowerShell 5.1
### Zerto Analytics
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/36) where the Zerto Analytics Rest Request function was not checking for the token before attempting a connection.
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/40) where the `Get-ZAVpg` method would return a 404 error when a `-vpgIdentifier` parameter was specified.
### General Updates
* Updated the way that tests are invoked and parsed to ensure that both source and built module files are tested. This will ensure that what is being shipped passes all tests along with testing of the source files.
* Added additional parameter validation tests to several of the functions. On-going effort to complete stand alone unit testing of each function.
## [Initial Release]
### Zerto Virtual Manager
* Updated `Invoke-ZertoRestRequest` to work in Powershell 5.1 as well as Powershell core
### Zerto Analytics
* Implemented Zerto Analytics Functionality. Please see [Getting Started with Zerto Analytics](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics)
+2 -6
View File
@@ -4,8 +4,8 @@ PowerShell wrapper for Zerto Virtual Manager API
## Current Build Status ## Current Build Status
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0e31e5cdad534271ac688a82cc3ca17d)](https://app.codacy.com/app/wcarroll/ZertoApiWrapper?utm_source=github.com&utm_medium=referral&utm_content=wcarroll/ZertoApiWrapper&utm_campaign=Badge_Grade_Settings)
[![Build Status](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_apis/build/status/ZertoPublic.ZertoApiWrapper?branchName=master)](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master) [![Build Status](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_apis/build/status/ZertoPublic.ZertoApiWrapper?branchName=master)](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master)
[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/ZertoApiWrapper?label=PowerShell%20Gallery%20Downloads)](https://www.powershellgallery.com/packages/ZertoApiWrapper)
## Legal Disclaimer ## Legal Disclaimer
@@ -32,14 +32,10 @@ PS> Install-Module -name ZertoApiWrapper
## Recent Updates ## Recent Updates
* June 16th, 2019: Added functionality for Zerto Analytics. All recent updates can now be tracked via the [Change Log](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/CHANGELOG.md).
* May 31st, 2019: Implement logic to allow use of this module in both Windows PowerShell 5.1 and PowerShell Core.
* March 15th, 2019: Implement Export and Import Functionality. Please See [Export-ZertoVpg Help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Export-ZertoVpg.md) and [Import-ZertoVpg Help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVpg.md) for assistance. No current pre-seed support.
* March 11th, 2019: Create basic VPG completed. Please see [New-ZertoVpg Help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md)
## TODO ## TODO
* Complete Help Markdown Files
* JFLR Functionality * JFLR Functionality
* Create VPG (Per-VM modification and Backup Settings) * Create VPG (Per-VM modification and Backup Settings)
* Edit VPG * Edit VPG
-18
View File
@@ -1,18 +0,0 @@
### Zerto Virtual Manager
* Added two functions to aid in bulk updating of NIC information for protected VMs. ([Issue 38](https://github.com/ZertoPublic/ZertoApiWrapper/issues/38))
* [Export-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVmNicSettings.md)
* [Import-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVmNicSettings.md)
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/43) where a VPG being created with a single VM member would not be parsed by the API correctly using PowerShell 5.1
### Zerto Analytics
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/36) where the Zerto Analytics Rest Request function was not checking for the token before attempting a connection.
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/40) where the `Get-ZAVpg` method would return a 404 error when a `-vpgIdentifier` parameter was specified.
### General Updates
* Updated the way that tests are invoked and parsed to ensure that both source and built module files are tested. This will ensure that what is being shipped passes all tests along with testing of the source files.
* Added additional parameter validation tests to several of the functions. On-going effort to complete stand alone unit testing of each function.
+13 -13
View File
@@ -1,45 +1,45 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
InModuleScope -ModuleName ZertoApiWrapper { InModuleScope -ModuleName ZertoApiWrapper {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "have a mandatory parameter for the Input Object" { It "have a mandatory parameter for the Input Object" {
Get-Command $global:function | Should -HaveParameter InputObject -Mandatory -Type PSCustomObject Get-Command $global:function | Should -HaveParameter InputObject -Mandatory -Type PSCustomObject
} }
it "Input Object should not accecpt a Null or Empty value" { It "Input Object should not accecpt a Null or Empty value" {
$myObj = [PSCustomObject]@{ } $myObj = [PSCustomObject]@{ }
{ Get-Map -InputObject $myObj -Key "Key" -Value "Value" } | Should Throw { Get-Map -InputObject $myObj -Key "Key" -Value "Value" } | Should Throw
{ Get-Map -InputObject $null -Key "Key" -Value "Value" } | Should Throw { Get-Map -InputObject $null -Key "Key" -Value "Value" } | Should Throw
{ Get-Map -InputObject "" -Key "Key" -Value "Value" } | Should Throw { Get-Map -InputObject "" -Key "Key" -Value "Value" } | Should Throw
} }
it "have a mandatory string parameter for the Map Key" { It "have a mandatory string parameter for the Map Key" {
Get-Command $global:function | Should -HaveParameter Key -Mandatory -Type String Get-Command $global:function | Should -HaveParameter Key -Mandatory -Type String
} }
it "The Map variable should not accecpt a Null or Empty value" { It "The Map variable should not accecpt a Null or Empty value" {
$myObj = [PSCustomObject]@{one = 1; two = 2 } $myObj = [PSCustomObject]@{one = 1; two = 2 }
{ Get-Map -InputObject $myObj -Key "" -Value "Value" } | Should Throw { Get-Map -InputObject $myObj -Key "" -Value "Value" } | Should Throw
{ Get-Map -InputObject $null -Key $null -Value "Value" } | Should Throw { Get-Map -InputObject $null -Key $null -Value "Value" } | Should Throw
{ Get-Map -InputObject $myObj -Key 1 -Value "Value" } | Should Throw { Get-Map -InputObject $myObj -Key 1 -Value "Value" } | Should Throw
} }
it "The Value variable should not accecpt a Null or Empty value" { It "The Value variable should not accecpt a Null or Empty value" {
$myObj = [PSCustomObject]@{one = 1; two = 2 } $myObj = [PSCustomObject]@{one = 1; two = 2 }
{ Get-Map -InputObject $myObj -Key "Key" -Value "" } | Should Throw { Get-Map -InputObject $myObj -Key "Key" -Value "" } | Should Throw
{ Get-Map -InputObject $myObj -Key "Key" -Value $null } | Should Throw { Get-Map -InputObject $myObj -Key "Key" -Value $null } | Should Throw
{ Get-Map -InputObject $myObj -Key "Key" -Value 1 } | Should Throw { Get-Map -InputObject $myObj -Key "Key" -Value 1 } | Should Throw
} }
it "have a mandatory string parameter for the Map Value" { It "have a mandatory string parameter for the Map Value" {
Get-Command $global:function | Should -HaveParameter Value -Mandatory -Type String Get-Command $global:function | Should -HaveParameter Value -Mandatory -Type String
} }
it "should have an Output type of Hashtable" { It "should have an Output type of Hashtable" {
(Get-Command $global:function).OutputType.Name | Should -Match "Hashtable" (Get-Command $global:function).OutputType.Name | Should -Match "Hashtable"
} }
} }
@@ -49,15 +49,15 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeEach { BeforeEach {
$MyMap = Get-Map -InputObject $MyObj -Key "vmIdentifier" -Value "vmName" $MyMap = Get-Map -InputObject $MyObj -Key "vmIdentifier" -Value "vmName"
} }
it "Returned object should be a hashtable" { It "Returned object should be a hashtable" {
$myMap | Should -BeOfType Hashtable $myMap | Should -BeOfType Hashtable
} }
it "should return a hashtable with 3 entries" { It "should return a hashtable with 3 entries" {
$myMap.count | should -Be 3 $myMap.count | Should -Be 3
} }
it "should be properly mapped" { It "should be properly mapped" {
$myMap["vmid.12"] | Should -Be "ExchangeMailbox" $myMap["vmid.12"] | Should -Be "ExchangeMailbox"
$myMap["vmid.13"] | Should -Be "ExchangeApplication" $myMap["vmid.13"] | Should -Be "ExchangeApplication"
$myMap["vmid.14"] | Should -Be "ExchangeWeb" $myMap["vmid.14"] | Should -Be "ExchangeWeb"
+10 -10
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -16,7 +16,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
{ Get-ZertoApiFilter -filtertable $null } | Should Throw { Get-ZertoApiFilter -filtertable $null } | Should Throw
} }
it "should have an Output type of String" { It "should have an Output type of String" {
(Get-Command $global:function).OutputType.Name | Should -Match "String" (Get-Command $global:function).OutputType.Name | Should -Match "String"
} }
} }
@@ -47,19 +47,19 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
} }
it "converts bool to text" { It "converts bool to text" {
Get-ZertoApiFilter -filtertable $singleBoolItemTest | should -Be "?BoolItem=True" Get-ZertoApiFilter -filtertable $singleBoolItemTest | Should -Be "?BoolItem=True"
} }
it "one item test" { It "one item test" {
Get-ZertoApiFilter -filtertable $oneItemTest | should be "?OneItem=Test" Get-ZertoApiFilter -filtertable $oneItemTest | Should -Be "?OneItem=Test"
} }
it "should ignore CommonParameters" { It "should ignore CommonParameters" {
Get-ZertoApiFilter -filtertable $commonParamTest | should be "?OneItem=Test" Get-ZertoApiFilter -filtertable $commonParamTest | Should -Be "?OneItem=Test"
} }
it "should process a filter table with more than one item" { It "should process a filter table with more than one item" {
$returnString = Get-ZertoApiFilter -filtertable $twoItemTest $returnString = Get-ZertoApiFilter -filtertable $twoItemTest
$returnString | Should -match "^\?" $returnString | Should -match "^\?"
$returnString | Should -match "&" $returnString | Should -match "&"
+52 -24
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll { BeforeAll {
@@ -9,34 +9,55 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
It "Has a mandatory string parameter for the target host" { It "$global:function should have exactly 16 parameters defined" {
Get-Command $global:function | Should -HaveParameter TargetHost -Mandatory -Type String (Get-Command $global:function).Parameters.Count | Should -Be 16
} }
It "Will not take a non-ip address as a 'TargetHost'" { $ParameterTestCases = @(
{ Add-ZertoPeerSite -targetHost 'MyZVMHost' -targetPort '9081' } | Should -Throw @{ParameterName = 'targetHost'; Type = 'String'; Mandatory = $true; Validation = 'Script' }
{ Add-ZertoPeerSite -targetHost '192.168.1.266' -targetPort '9081' } | Should -Throw @{ParameterName = 'targetPort'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
{ Add-ZertoPeerSite -targetHost '192.168.1' -targetPort '9081' } | Should -Throw @{ParameterName = 'token'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
{ Add-ZertoPeerSite -targetHost $null -targetPort '9081' } | Should -Throw )
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
} }
It "Has a non-mandatory string parameter for the target port with default value of 9081" { It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
Get-Command Add-ZertoPeerSite | Should -HaveParameter TargetPort -Not -Mandatory param($ParameterName, $Validation)
Get-Command Add-ZertoPeerSite | Should -HaveParameter TargetPort -Type Int32 Switch ($Validation) {
Get-Command Add-ZertoPeerSite | Should -HaveParameter TargetPort -DefaultValue 9081 'Script' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
} }
It "Will not take a non-int as a port" { It "targetPort Parameter should have a default value of 9081" {
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 'string' } | Should -Throw Get-Command $global:function | Should -HaveParameter targetPort -DefaultValue 9081
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $true } | Should -Throw
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $null } | Should -Throw
} }
It "Will fail if the specified port is outside of the range 1024 - 65535" { It "targetPort Parameter should have a Min value of 1024" {
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 1023 } | Should -Throw (Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1024
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 65536 } | Should -Throw }
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 0 } | Should -Throw
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort -1 } | Should -Throw It "targetPort Parameter should have a Max value of 65535" {
(Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 65535
} }
It "Supports 'SupportsShouldProcess'" { It "Supports 'SupportsShouldProcess'" {
@@ -52,19 +73,26 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
return (Get-Content "$global:here\Mocks\TaskId.txt") return (Get-Content "$global:here\Mocks\TaskId.txt")
} }
It "Returns a string value" { It "Returns a string value when no Token Passed" {
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' $results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081'
$results | Should -Not -BeNullOrEmpty $results | Should -Not -BeNullOrEmpty
$results | Should -BeOfType "String" $results | Should -BeOfType "String"
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" $results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
} }
It "Returns a string value when a Token is passed" {
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -token "NotARealTokenString"
$results | Should -Not -BeNullOrEmpty
$results | Should -BeOfType "String"
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
}
It "Does not return a taskId if '-whatif' is used" { It "Does not return a taskId if '-whatif' is used" {
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -WhatIf $results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -WhatIf
$results | Should -BeNullOrEmpty $results | Should -BeNullOrEmpty
} }
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 1 Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2
} }
} }
Remove-Variable -Name here -Scope Global Remove-Variable -Name here -Scope Global
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll { BeforeAll {
@@ -16,7 +16,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$($global:function)::Parameter Unit Tests" { Context "$($global:function)::Parameter Unit Tests" {
It "Has a parameter for the VpgName that is Mandatory" { It "Has a parameter for the VpgName that is Mandatory" {
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory -Type String Get-Command $global:function | Should -HaveParameter vpgName -Mandatory -Type 'String[]'
} }
It "Has a parameter for the CheckpointName that is Mandatory" { It "Has a parameter for the CheckpointName that is Mandatory" {
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll { BeforeAll {
@@ -13,8 +13,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
} }
Context "$($global:function)::Function Unit Tests" { Context "$($global:function)::Function Unit Tests" {
InModuleScope -ModuleName ZertoApiWrapper { InModuleScope -ModuleName ZertoApiWrapper {
@@ -68,7 +66,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZARestRequest -Exactly 1 Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZARestRequest -Exactly 1
} }
} }
Remove-Variable -Name function -Scope Global Remove-Variable -Name function -Scope Global
+7 -7
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll { BeforeAll {
@@ -89,7 +89,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
It "Module Scope zvmHeaders variable tests" { It "Module Scope zvmHeaders variable tests" {
$script:zvmHeaders | Should -Not -BeNullOrEmpty $script:zvmHeaders | Should -Not -BeNullOrEmpty
$script:zvmHeaders | Should -BeOfType PSCustomObject $script:zvmHeaders | Should -BeOfType PSCustomObject
$script:zvmHeaders.keys.count | Should -BeExactly 2 $script:zvmHeaders.keys.count | Should -BeExactly 3
$script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue $script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue
$script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue $script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue
$script:zvmHeaders['x-zerto-session'] | Should -BeOfType String $script:zvmHeaders['x-zerto-session'] | Should -BeOfType String
@@ -105,11 +105,11 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders $headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders
It "returns a Hashtable with 2 keys" { It "returns a Hashtable with 2 keys" {
$headers | Should -BeOfType Hashtable $headers | Should -BeOfType Hashtable
$headers.keys.count | Should be 2 $headers.keys.count | Should -Be 3
} }
It "return value has a key called 'x-zerto-session'" { It "return value has a key called 'x-zerto-session'" {
$headers.ContainsKey('x-zerto-session') | Should be $true $headers.ContainsKey('x-zerto-session') | Should -Be $true
} }
It "return key 'x-zerto-session' value should be a string" { It "return key 'x-zerto-session' value should be a string" {
@@ -118,11 +118,11 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
It "return value has a key called 'accept'" { It "return value has a key called 'accept'" {
$headers.ContainsKey('accept') | Should be $true $headers.ContainsKey('accept') | Should -Be $true
} }
It "return key 'accept' value should be 'application/json'" { It "return key 'accept' value should be 'application/json'" {
$headers['accept'] | Should be 'application/json' $headers['accept'] | Should -Be 'application/json'
} }
It "should not require a port to be specified" { It "should not require a port to be specified" {
+127
View File
@@ -0,0 +1,127 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll {
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
}
Context "$($global:function)::Parameter Unit Tests" {
It "$global:function should have exactly 16 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 16
}
$ParameterTestCases = @(
@{ParameterName = 'SourceVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'NewVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'VMs'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
$null {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.TypeId.Count | Should -Be 2
}
}
}
It "Supports 'SupportsShouldProcess'" {
Get-Command $global:function | Should -HaveParameter WhatIf
Get-Command $global:function | Should -HaveParameter Confirm
$script:ScriptBlock | Should -match 'SupportsShouldProcess'
$script:ScriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)'
}
}
Context "$($global:function)::Function Unit Tests" {
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -ParameterFilter {
$vpgName -eq "MyVpg"
} {
return (Get-Content "$global:here\Mocks\GetVpg.json" -Raw | ConvertFrom-Json)
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -ParameterFilter {
$vpgName -eq "NotAVpg"
} {
return $null
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoUnprotectedVm {
return (Get-Content "$global:here\Mocks\UnprotectedVms.json" -Raw | ConvertFrom-Json)
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoProtectedVm {
return (Get-Content "$global:here\Mocks\ProtectedVms.json" -Raw | ConvertFrom-Json)
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq "vpgSettings/copyVpgSettings"
} {
return (Get-Content "$global:here\Mocks\VpgId.txt")
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq "vpgSettings/9607f923-00a7-477b-8b04-26a386214455/vms"
} {
return $null
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq "vpgSettings/9607f923-00a7-477b-8b04-26a386214455"
} {
return (Get-Content "$global:here\Mocks\CopyVpgSettings.json" -Raw | ConvertFrom-Json)
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Save-ZertoVpgSetting {
return (Get-Content "$global:here\Mocks\TaskId.txt")
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Get-Map -ParameterFilter {
$null -ne $InputObject[0].VpgName
} {
@{
"WindowsBox" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-90"
"CentOS-Test" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-88"
"Application01" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-35"
"sql01-test" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-73"
"jenkins" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-75"
}
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Get-Map -ParameterFilter {
$null -eq $InputObject[0].VpgName
} {
@{
"Win2019Template" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-79"
"Ubuntu01" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-34"
"WinTemplate" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-25"
"sql01-prod" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-87"
"nczvm.nc.lab" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-30"
}
} -Verifiable
It "Should throw an error when no VPG is found" {
{ Copy-ZertoVpg -SourceVpgName "NotAVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01' } | Should Throw "Unable to find a VPG with the name:"
}
It "Returns a TaskIdentifier when called correctly" {
Copy-ZertoVpg -SourceVpgName "MyVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01' | Should -Be "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
}
It "Should warn when VM is not found" {
$results = Copy-ZertoVpg -SourceVpgName "MyVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01', 'DoesNotExist' 3>&1
$results[0].ToString() | Should -Match 'Unable to find VM with Name DoesNotExist. Skipping.'
}
Assert-VerifiableMock
}
}
Remove-Variable -Name function -Scope Global
Remove-Variable -Name here -Scope Global
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+21 -15
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -8,7 +8,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Get-Content $global:here\Mocks\TaskId.txt Get-Content $global:here\Mocks\TaskId.txt
} }
Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -eq "MyVraIdentifier" } { Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -in @("MyVraIdentifier", "PasswordVraIdentifier") } {
Get-Content $global:here\Mocks\GetSingleVra.json -Raw | ConvertFrom-Json Get-Content $global:here\Mocks\GetSingleVra.json -Raw | ConvertFrom-Json
} }
@@ -28,6 +28,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $false } @{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $false }
@{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $false } @{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $false }
@{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $false } @{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $false }
@{ParameterName = 'HostRootPassword'; Type = 'securestring'; Mandatory = $false }
) )
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases { It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
@@ -40,7 +41,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ ParameterName = 'groupName' } @{ ParameterName = 'groupName' }
) )
it "<ParameterName> validates against null or empty values" -TestCases $StringTestCases { It "<ParameterName> validates against null or empty values" -TestCases $StringTestCases {
param($ParameterName) param($ParameterName)
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
@@ -52,11 +53,18 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ParameterName = 'subnetMask' } @{ParameterName = 'subnetMask' }
) )
it "<ParameterName> validates string for a valid IP Address" -TestCases $IpAddrTestCases { It "<ParameterName> validates string for a valid IP Address" -TestCases $IpAddrTestCases {
param($ParameterName) param($ParameterName)
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1 $attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '^\$_ \-match \[IPAddress\]\$_' $attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
}
It "Supports 'SupportsShouldProcess'" {
Get-Command $global:function | Should -HaveParameter WhatIf
Get-Command $global:function | Should -HaveParameter Confirm
(Get-Command $global:function).ScriptBlock | Should -Match 'SupportsShouldProcess'
(Get-Command $global:function).ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
} }
} }
@@ -64,8 +72,8 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
It "Returns a task id string" { It "Returns a task id string" {
$results = Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -groupName "MyGroup" $results = Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -groupName "MyGroup"
$results | should not benullorempty $results | Should not benullorempty
$results | should -BeOfType "String" $results | Should -BeOfType "String"
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" $results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
} }
@@ -81,16 +89,14 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Edit-ZertoVra -vraIdentifier "DhcpVraIdentifier" -groupName "MyNewGroup" | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" Edit-ZertoVra -vraIdentifier "DhcpVraIdentifier" -groupName "MyNewGroup" | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
} }
it "Supports 'SupportsShouldProcess'" { It "Runs with root password provided" {
Get-Command $global:function | Should -HaveParameter WhatIf $SecurePassword = 'NotARealPassword' | ConvertTo-SecureString -AsPlainText -Force
Get-Command $global:function | Should -HaveParameter Confirm Edit-ZertoVra -vraIdentifier "PasswordVraIdentifier" -HostRootPassword $SecurePassword | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
(Get-Command $global:function).ScriptBlock | Should -Match 'SupportsShouldProcess'
(Get-Command $global:function).ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
} }
} }
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 3 Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra -Exactly 4 Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra -Exactly 5
} }
Remove-Variable -Name function -Scope Global Remove-Variable -Name function -Scope Global
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -16,7 +16,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
} }
it "<ParameterName> has <Validation> validation set" -TestCases $ParameterTestCases { It "<ParameterName> has <Validation> validation set" -TestCases $ParameterTestCases {
param($ParameterName) param($ParameterName)
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
@@ -24,7 +24,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
Context "$global:function::Function Unit Tests" { Context "$global:function::Function Unit Tests" {
} }
} }
+6 -6
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -199,11 +199,11 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$outputPath = "TestDrive:" $outputPath = "TestDrive:"
it "Output path should exist" { It "Output path should exist" {
$outputPath | Should -Exist $outputPath | Should -Exist
} }
it "Exported JSON file should exist after function called" { It "Exported JSON file should exist after function called" {
$vpgName = "HRIS" $vpgName = "HRIS"
Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName
$outputFile = "{0}\{1}.json" -f $outputPath, $vpgName $outputFile = "{0}\{1}.json" -f $outputPath, $vpgName
@@ -211,11 +211,11 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$outputFile | Should -Not -BeNullOrEmpty $outputFile | Should -Not -BeNullOrEmpty
} }
it "Only one file should be present in the TestDrive" { It "Only one file should be present in the TestDrive" {
(Get-ChildItem $outputPath).Count | Should -BeExactly 1 (Get-ChildItem $outputPath).Count | Should -BeExactly 1
} }
it "Should be valid JSON" { It "Should be valid JSON" {
$vpgName = "HRIS" $vpgName = "HRIS"
Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName
$outputFile = "{0}\{1}.json" -f $outputPath, $vpgName $outputFile = "{0}\{1}.json" -f $outputPath, $vpgName
+7 -7
View File
@@ -1,13 +1,13 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "LimitTo Parameter should have a Min value of 1" { It "LimitTo Parameter should have a Min value of 1" {
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 1 (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1
} }
It "LimitTo Parameter should have a Max value of 1000000" { It "LimitTo Parameter should have a Max value of 1000000" {
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 1000000 (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000
} }
} }
+5 -5
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+8 -8
View File
@@ -1,13 +1,13 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 16 parameters defined" { It "$global:function should have exactly 16 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 16 (Get-Command $global:function).Parameters.Count | Should -Be 16
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -42,21 +42,21 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "LimitTo Parameter should have a Min value of 1" { It "LimitTo Parameter should have a Min value of 1" {
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 1 (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1
} }
It "LimitTo Parameter should have a Max value of 1000000" { It "LimitTo Parameter should have a Max value of 1000000" {
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 1000000 (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000
} }
It "Category parameter should only have 2 options" { It "Category parameter should only have 2 options" {
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should Be 2 (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 2
} }
It "Category parameter should take 'events'" { It "Category parameter should take 'events'" {
@@ -1,13 +1,13 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -36,17 +36,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
+5 -5
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+5 -5
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+4 -4
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 11 parameters defined" { It "$global:function should have exactly 11 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 11 (Get-Command $global:function).Parameters.Count | Should -Be 11
} }
} }
+5 -5
View File
@@ -1,15 +1,15 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 12 parameters defined" { It "$global:function should have exactly 12 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 12 (Get-Command $global:function).Parameters.Count | Should -Be 12
} }
it "$global:function has a non-mandatory string parameter for the zOrgIdentifier" { It "$global:function has a non-mandatory string parameter for the zOrgIdentifier" {
Get-Command $global:function | Should -HaveParameter zOrgIdentifier -Type String Get-Command $global:function | Should -HaveParameter zOrgIdentifier -Type String
Get-Command $global:function | Should -HaveParameter zOrgIdentifier -not -Mandatory Get-Command $global:function | Should -HaveParameter zOrgIdentifier -not -Mandatory
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -37,17 +37,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -37,17 +37,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -36,7 +36,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -36,7 +36,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -34,7 +34,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -34,7 +34,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -0,0 +1,57 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 17 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 17
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,57 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 17 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 17
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'interval'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
+42
View File
@@ -0,0 +1,42 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 12 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 12
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String[]'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,57 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 17 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 17
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,56 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 14 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 16
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,56 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 16 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 16
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
+41
View File
@@ -0,0 +1,41 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 14 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 14
}
$ParameterTestCases = @(
@{ParameterName = 'AllVms'; Type = 'Switch'; Mandatory = $false; Validation = $Null }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'Volumes'; Type = 'Switch'; Mandatory = $false; Validation = $Null }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,39 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 12 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 12
}
$ParameterTestCases = @(
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+5 -5
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -35,17 +35,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 60" { It "Interval Parameter should have a Min value of 60" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 60 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60
} }
It "Interval Parameter should have a Max value of 2678400" { It "Interval Parameter should have a Max value of 2678400" {
(Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 2678400 (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -14,7 +14,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
It "zOrgIdentifier has the NotNullOrEmpty Validator" { It "zOrgIdentifier has the NotNullOrEmpty Validator" {
(Get-Command $global:function).Parameters['zOrgIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should Be 1 (Get-Command $global:function).Parameters['zOrgIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -29,7 +29,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -27,7 +27,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+5 -5
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -34,17 +34,17 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "Interval Parameter should have a Min value of 1" { It "Interval Parameter should have a Min value of 1" {
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 1 (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1
} }
It "Interval Parameter should have a Max value of 1000000" { It "Interval Parameter should have a Max value of 1000000" {
(Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 1000000 (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -30,7 +30,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -28,7 +28,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -12,7 +12,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
It "datastoreIdentifier parameter does not take null or empty values" { It "datastoreIdentifier parameter does not take null or empty values" {
(Get-Command $global:function).Parameters['datastoreIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.count | Should Be 1 (Get-Command $global:function).Parameters['datastoreIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.count | Should -Be 1
} }
} }
+7 -7
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -12,7 +12,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$ParameterTestCases = @( $ParameterTestCases = @(
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vpg'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'vpgName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@@ -53,13 +53,13 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
It "entityType parameter only accecpts 4 different values" { It "entityType parameter only accecpts 4 different values" {
(Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should be 4 (Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 4
} }
It "entityType parameter accecpts 'VPG' as a Value" { It "entityType parameter accecpts 'VPG' as a Value" {
@@ -79,7 +79,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
It "category parameter only accecpts 3 different values" { It "category parameter only accecpts 3 different values" {
(Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should be 3 (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 3
} }
It "category parameter accecpts 'All' as a Value" { It "category parameter accecpts 'All' as a Value" {
@@ -95,7 +95,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
It "eventCategory parameter only accecpts 3 different values" { It "eventCategory parameter only accecpts 3 different values" {
(Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should be 3 (Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 3
} }
It "eventCategory parameter accecpts 'All' as a Value" { It "eventCategory parameter accecpts 'All' as a Value" {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+3 -3
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -38,7 +38,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | Should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -1,15 +1,259 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll {
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
}
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 23 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 23
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'hostIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'folders'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'hostClusters'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'hosts'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'networks'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'resourcePools'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'vms'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'repositories'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting of <Validation>" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Validation)
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
$Null {
$Type -match 'Switch' | Should -BeTrue -Because "Only Switch Parameters should not have validation"
}
default {
$true | Should -BeFalse -Because "No Validation Selected. Review test cases"
}
}
}
It "$($global:function) does not have 'SupportsShouldProcess'" {
Get-Command $global:function | Should -not -HaveParameter WhatIf
Get-Command $global:function | Should -not -HaveParameter Confirm
$script:ScriptBlock | Should -not -match 'SupportsShouldProcess'
$script:ScriptBlock | Should -not -match '\$PSCmdlet\.ShouldProcess\(.+\)'
}
} }
Context "$global:function::Parameter Functional Tests" { Context "$global:function::Parameter Functional Tests" {
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-NoParams.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-devices.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-devices-hostid.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-hosts.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts/4567'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-hosts-hostid.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-SiteId.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastores'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-datastores.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastoreclusters'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-datastoreClusters.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/networks'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-Networks.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/folders'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-Folders.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hostclusters'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-hostClusters.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/resourcepools'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-ResourcePools.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/vms'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-VMs.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/repositories'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-repositories.json" -Raw) | ConvertFrom-Json
} -Verifiable
It "Should return all known sites when called without parameters" {
$results = Get-ZertoVirtualizationSite
$results.Count | Should -BeExactly 2
}
It "Should return a single site when a siteIdentifier is provided" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234'
$results.VirtualizationSiteName | Should -BeExactly 'cavc.nc.lab'
$results.siteIdentifier | Should -BeExactly '8e1c9f53-4973-4a4a-b2dd-1ebb293614d8'
}
It "Should return a list of devices with the '-devices' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices
$results.Count | Should -BeExactly 5
}
It "Should return a list of devices with the '-devices' switch and hostIdentifier provided" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices -hostIdentifier '4567'
$results.Count | Should -BeExactly 5
}
It "Should return a list of hosts with the '-hosts' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts
$results.Count | Should -BeExactly 3
}
It "Should return a single host with the '-hosts' switch and hostIdentifier provided" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts -hostIdentifier '4567'
$results.VirtualizationHostName | Should -BeExactly "caesx3.nc.lab"
$results.hostIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.host-18"
}
It "Should return a list of datastores with the '-datastores' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastores
$results.Count | Should -BeExactly 8
}
It "Should return a list of datastores with the '-datastoreClusters' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastoreClusters
$results.DatastoreClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.group-p44"
$results.DatastoreClusterName | Should -BeExactly "CA_DS_Cluster"
}
It "Should return a list of Networks with the '-networks' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -networks
$results.NetworkIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.network-20"
$results.VirtualizationNetworkName | Should -BeExactly "VM Network"
}
It "Should return a list of folders with the '-folders' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -folders
$results.Count | Should -BeExactly 3
}
It "Should return a list of Host Clusters with the '-hostClusters' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hostClusters
$results.ClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7"
$results.VirtualizationClusterName | Should -BeExactly "CA Cluster"
}
It "Should return a list of Resource Pools with the '-resourcePools' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -resourcePools
$results.ResourcePoolIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.resgroup-8"
$results.ResourcePoolName | Should -BeExactly "Resources"
}
It "Should return a list of VMs with the '-VMs' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -vms
$results.Count | Should -BeExactly 4
}
It "Should return a list of LTR Repositories with the '-repositories' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -repositories
$results.ConnectionType | Should -BeExactly "ServerMessageBlock"
$results.RepositoryIdentifier | Should -BeExactly "120355ce-fcd0-4820-a971-787d0470793b"
$results.RepositoryName | Should -BeExactly "Synology"
$results.StorageType | Should -BeExactly "NetworkShare"
$results.Path | Should -not -be $null
}
Assert-VerifiableMock
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts/4567'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastores'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastoreclusters'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/networks'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/folders'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hostclusters'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/resourcepools'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/vms'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/repositories'
} -Exactly 1
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 11 parameters defined" { It "$global:function should have exactly 11 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
It "Has a mandatory string array parameter for the settings file to import" { It "Has a mandatory string array parameter for the settings file to import" {
+4 -4
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 12 parameters defined" { It "$global:function should have exactly 12 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 12 (Get-Command $global:function).Parameters.Count | Should -Be 12
} }
It "Has a mandatory string array parameter for the settings file to import" { It "Has a mandatory string array parameter for the settings file to import" {
+8 -6
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 22 parameters defined" { It "$global:function should have exactly 24 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 22 (Get-Command $global:function).Parameters.Count | Should -Be 24
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -17,6 +17,8 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } @{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
@{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } @{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
@{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } @{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
@{ParameterName = 'UseRootCredential'; Type = 'Switch'; Mandatory = $true; Validation = $null }
@{ParameterName = 'HostRootPassword'; Type = 'SecureString'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
) )
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases { It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
@@ -35,12 +37,12 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
'IpAddr' { 'IpAddr' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1 $attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '^\$_ \-match \[IPAddress\]\$_' $attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
} }
$null { $null {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.TypeId.Count | Should -Be 2 $attrs.TypeId.Count | Should -Be 3
} }
} }
} }
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -12,7 +12,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ParameterName = 'uri'; Type = 'String'; Mandatory = $true; TestName = 'URI' } @{ParameterName = 'uri'; Type = 'String'; Mandatory = $true; TestName = 'URI' }
@{ParameterName = 'method'; Type = 'String'; Mandatory = $false; TestName = 'Method' } @{ParameterName = 'method'; Type = 'String'; Mandatory = $false; TestName = 'Method' }
@{ParameterName = 'body'; Type = 'String'; Mandatory = $false; TestName = 'Body' } @{ParameterName = 'body'; Type = 'String'; Mandatory = $false; TestName = 'Body' }
@{ParameterName = 'contentType'; Type = 'String'; Mandatory = $false; TestName = 'contentType' }
) )
It "Parameter present and Type test for: <TestName> " -TestCases $testCases { It "Parameter present and Type test for: <TestName> " -TestCases $testCases {
@@ -29,14 +28,9 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Get-Command $global:function | Should -HaveParameter Method -DefaultValue "GET" Get-Command $global:function | Should -HaveParameter Method -DefaultValue "GET"
} }
It "ContentType parameter default is 'application/json'" {
Get-Command $global:function | Should -HaveParameter contentType -DefaultValue "application/json"
}
$NotNullOrEmptyTests = @( $NotNullOrEmptyTests = @(
@{ParameterName = 'uri'; TestName = 'Uri' } @{ParameterName = 'uri'; TestName = 'Uri' }
@{ParameterName = 'body'; TestName = 'Body' } @{ParameterName = 'body'; TestName = 'Body' }
@{ParameterName = 'contentType'; TestName = 'ContentType' }
) )
It "<TestName> parameter does not accecpt a null or empty value" -TestCases $NotNullOrEmptyTests { It "<TestName> parameter does not accecpt a null or empty value" -TestCases $NotNullOrEmptyTests {
@@ -69,7 +63,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
It "runs when called" { It "runs when called" {
Invoke-ZARestRequest -uri "myuri" | Should Be "Ran Command" Invoke-ZARestRequest -uri "myuri" | Should -Be "Ran Command"
} }
It "throws when the last action was over 60 minutes ago" { It "throws when the last action was over 60 minutes ago" {
@@ -0,0 +1,54 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 16 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 16
}
$ParameterTestCases = @(
@{ParameterName = 'hostName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty'; ParameterSet = @('hostName') }
@{ParameterName = 'vraName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraName') }
@{ParameterName = 'vraIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraIdentifier') }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
$null {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.TypeId.Count | Should -Be 2
}
}
}
It "<ParameterName> parameter is part of the correct ParameterSet(s)" -TestCases $ParameterTestCases {
param($ParameterName, $ParameterSet)
$commandParameterSets = (Get-Command $global:function).Parameters[$ParameterName].ParameterSets
foreach ($Set in $ParameterSet) {
$commandParameterSets.ContainsKey($Set) | Should -BeTrue
}
$commandParameterSets.Count | Should -Be $ParameterSet.Count
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
+7 -7
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 20 parameters defined" { It "$global:function should have exactly 20 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 20 (Get-Command $global:function).Parameters.Count | Should -Be 20
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -55,7 +55,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -82,11 +82,11 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
(Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 2 (Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 2
} }
it "Time to wait before shutdown in sec should have a default value of 3600" { It "Time to wait before shutdown in sec should have a default value of 3600" {
Get-Command $global:function | Should -HaveParameter timeToWaitBeforeShutdownInSec -DefaultValue 3600 Get-Command $global:function | Should -HaveParameter timeToWaitBeforeShutdownInSec -DefaultValue 3600
} }
it "Time to wait before shutdown in sec should have a minimum value of 300 and max value of 86400" { It "Time to wait before shutdown in sec should have a minimum value of 300 and max value of 86400" {
(Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300 (Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300
(Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400 (Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400
} }
@@ -1,13 +1,13 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 15 parameters defined" { It "$global:function should have exactly 15 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 15 (Get-Command $global:function).Parameters.Count | Should -Be 15
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -41,7 +41,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,16 +1,16 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 12 parameters defined" { It "$global:function should have exactly 12 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 12 (Get-Command $global:function).Parameters.Count | Should -Be 12
} }
it "has a mandatory string parameter for the vpgName" { It "has a mandatory string parameter for the vpgName" {
Get-Command $global:function | Should -HaveParameter vpgName Get-Command $global:function | Should -HaveParameter vpgName
Get-Command $global:function | Should -HaveParameter vpgName -Type string[] Get-Command $global:function | Should -HaveParameter vpgName -Type string[]
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory Get-Command $global:function | Should -HaveParameter vpgName -Mandatory
+5 -5
View File
@@ -1,16 +1,16 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 12 parameters defined" { It "$global:function should have exactly 12 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 12 (Get-Command $global:function).Parameters.Count | Should -Be 12
} }
it "has a mandatory string parameter for the vpgName" { It "has a mandatory string parameter for the vpgName" {
Get-Command $global:function | Should -HaveParameter vpgName Get-Command $global:function | Should -HaveParameter vpgName
Get-Command $global:function | Should -HaveParameter vpgName -Type string[] Get-Command $global:function | Should -HaveParameter vpgName -Type string[]
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory Get-Command $global:function | Should -HaveParameter vpgName -Mandatory
+6 -6
View File
@@ -1,12 +1,12 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 20 parameters defined" { It "$global:function should have exactly 20 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 20 (Get-Command $global:function).Parameters.Count | Should -Be 20
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -55,7 +55,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -67,7 +67,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
(Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'None' (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'None'
} }
it "Commit Policy Timeout should have a minimum value of 300 and max value of 86400" { It "Commit Policy Timeout should have a minimum value of 300 and max value of 86400" {
(Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300 (Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300
(Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400 (Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400
} }
@@ -1,13 +1,13 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 16 parameters defined" { It "$global:function should have exactly 16 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 16 (Get-Command $global:function).Parameters.Count | Should -Be 16
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -41,7 +41,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
} }
default { default {
$true | should be $false -Because "No Validation Selected. Review test cases" $true | Should -Be $false -Because "No Validation Selected. Review test cases"
} }
} }
} }
@@ -1,16 +1,16 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 14 parameters defined" { It "$global:function should have exactly 14 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 14 (Get-Command $global:function).Parameters.Count | Should -Be 14
} }
it "has a mandatory string parameter for the vpgName" { It "has a mandatory string parameter for the vpgName" {
Get-Command $global:function | Should -HaveParameter vpgName Get-Command $global:function | Should -HaveParameter vpgName
Get-Command $global:function | Should -HaveParameter vpgName -Type string[] Get-Command $global:function | Should -HaveParameter vpgName -Type string[]
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory Get-Command $global:function | Should -HaveParameter vpgName -Mandatory
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -14,9 +14,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$ParameterNameTestCases = @( $ParameterNameTestCases = @(
@{ParameterName = "uri"; Type = "String"; Mandatory = $true; DefaultValue = $null; TestName = "URI" } @{ParameterName = "uri"; Type = "String"; Mandatory = $true; DefaultValue = $null; TestName = "URI" }
@{ParameterName = "method"; Type = "String"; Mandatory = $false; DefaultValue = 'GET'; TestName = "Method" } @{ParameterName = "method"; Type = "String"; Mandatory = $false; DefaultValue = 'GET'; TestName = "Method" }
@{ParameterName = "apiVersion"; Type = "String"; Mandatory = $false; DefaultValue = 'v1'; TestName = "API Version" }
@{ParameterName = "body"; Type = "String"; Mandatory = $false; DefaultValue = $null; TestName = "Body" } @{ParameterName = "body"; Type = "String"; Mandatory = $false; DefaultValue = $null; TestName = "Body" }
@{ParameterName = "contentType"; Type = "String"; Mandatory = $false; DefaultValue = 'application/json'; TestName = "Content Type" }
@{ParameterName = "credential"; Type = "PSCredential"; Mandatory = $false; DefaultValue = $null; TestName = "Credential" } @{ParameterName = "credential"; Type = "PSCredential"; Mandatory = $false; DefaultValue = $null; TestName = "Credential" }
@{ParameterName = "returnHeaders"; Type = "Switch"; Mandatory = $false; DefaultValue = $null; TestName = "Return Headers" } @{ParameterName = "returnHeaders"; Type = "Switch"; Mandatory = $false; DefaultValue = $null; TestName = "Return Headers" }
) )
@@ -36,20 +34,18 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$ParameterValidationTestCases = @( $ParameterValidationTestCases = @(
@{ParameterName = "URI"; TestName = "URI" } @{ParameterName = "URI"; TestName = "URI" }
@{ParameterName = "apiVersion"; TestName = "Api Version" }
@{ParameterName = "body"; TestName = "Body" } @{ParameterName = "body"; TestName = "Body" }
@{ParameterName = "contentType"; TestName = "Content Type" }
) )
It "<TestName> parameter cannot be null or empty" -TestCases $ParameterValidationTestCases { It "<TestName> parameter cannot be null or empty" -TestCases $ParameterValidationTestCases {
param($ParameterName) param($ParameterName)
$thisParameter = $thisCommand.Parameters[$ParameterName] $thisParameter = $thisCommand.Parameters[$ParameterName]
$thisParameter.Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should Be 1 $thisParameter.Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
} }
It "Method parameter can only be 'GET', 'POST', 'PUT', 'DELETE'" { It "Method parameter can only be 'GET', 'POST', 'PUT', 'DELETE'" {
$thisParameter = $thisCommand.Parameters['method'] $thisParameter = $thisCommand.Parameters['method']
$thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.Count | Should Be 1 $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
$thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'GET' | Should -BeTrue $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'GET' | Should -BeTrue
$thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'PUT' | Should -BeTrue $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'PUT' | Should -BeTrue
$thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'POST' | Should -BeTrue $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'POST' | Should -BeTrue
+79
View File
@@ -0,0 +1,79 @@
{
"Basic": {
"JournalHistoryInHours": 24,
"Name": "Test-SQL_Copy_1",
"Priority": "Medium",
"ProtectedSiteIdentifier": "15aa0d43-69cd-400a-8b99-fe94bbac3e19",
"RecoverySiteIdentifier": "8e1c9f53-4973-4a4a-b2dd-1ebb293614d8",
"RpoInSeconds": 300,
"ServiceProfileIdentifier": null,
"TestIntervalInMinutes": 262080,
"UseWanCompression": true,
"ZorgIdentifier": null
},
"BootGroups": {
"BootGroups": [
"@{BootDelayInSeconds=0; BootGroupIdentifier=00000000-0000-0000-0000-000000000000; Name=Default}"
]
},
"Journal": {
"DatastoreIdentifier": null,
"Limitation": {
"HardLimitInMB": 153600,
"HardLimitInPercent": 0,
"WarningThresholdInMB": 115200,
"WarningThresholdInPercent": 0
}
},
"LongTermRetention": null,
"Networks": {
"Failover": {
"Hypervisor": "@{DefaultNetworkIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.network-20}",
"PublicCloud": null,
"VCD": null
},
"FailoverTest": {
"Hypervisor": "@{DefaultNetworkIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.network-20}",
"PublicCloud": null,
"VCD": null
}
},
"Protected": {
"VCD": null
},
"Recovery": {
"DefaultDatastoreClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-p44",
"DefaultDatastoreIdentifier": null,
"DefaultFolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v3",
"DefaultHostClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7",
"DefaultHostIdentifier": null,
"PublicCloud": null,
"ResourcePoolIdentifier": null,
"VCD": null
},
"Scripting": {
"PostBackup": null,
"PostRecovery": {
"Command": null,
"Parameters": null,
"TimeoutInSeconds": 300
},
"PreRecovery": {
"Command": null,
"Parameters": null,
"TimeoutInSeconds": 300
}
},
"Vms": [
{
"BootGroupIdentifier": "00000000-0000-0000-0000-000000000000",
"Journal": "@{DatastoreIdentifier=; Limitation=}",
"Nics": "",
"Recovery": "@{DatastoreClusterIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.group-p44; DatastoreIdentifier=; FolderIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.group-v3; HostClusterIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.domain-c7; HostIdentifier=; PublicCloud=; ResourcePoolIdentifier=; VCD=}",
"VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-87",
"Volumes": ""
}
],
"VpgIdentifier": null,
"VpgSettingsIdentifier": "0be951ef-229a-401c-9e0d-bd8a5baea19a"
}
+4
View File
@@ -0,0 +1,4 @@
{
"Token": "TH15ISN0T4R3AL70KEN",
"UtcExpirationDate": "10/09/2019 12:55 PM"
}
+18
View File
@@ -0,0 +1,18 @@
[
{
"VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-87",
"VmName": "sql01-prod"
},
{
"VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-34",
"VmName": "Ubuntu01"
},
{
"VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-79",
"VmName": "Win2019Template"
},
{
"VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-25",
"VmName": "WinTemplate"
}
]
@@ -0,0 +1,14 @@
[
{
"FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v3",
"FolderName": "/"
},
{
"FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v27",
"FolderName": "Templates"
},
{
"FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v9",
"FolderName": "Discovered virtual machine"
}
]
@@ -0,0 +1,4 @@
{
"NetworkIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.network-20",
"VirtualizationNetworkName": "VM Network"
}
@@ -0,0 +1,10 @@
[
{
"SiteIdentifier": "8e1c9f53-4973-4a4a-b2dd-1ebb293614d8",
"VirtualizationSiteName": "cavc.nc.lab"
},
{
"SiteIdentifier": "15aa0d43-69cd-400a-8b99-fe94bbac3e19",
"VirtualizationSiteName": "ncvc.nc.lab"
}
]
@@ -0,0 +1,4 @@
{
"ResourcePoolIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.resgroup-8",
"ResourcepoolName": "Resources"
}

Some files were not shown because too many files have changed in this diff Show More