{"action":"created","comment":{"url":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/comments/45914473","id":45914473,"diff_hunk":"@@ -0,0 +1,83 @@\n+<#\n+.Synopsis\n+   Template for creating DSC Resource Integration Tests\n+.DESCRIPTION\n+   To Use:\n+     1. Copy to \\Tests\\Integration\\ folder and rename MSFT_x<ResourceName>.Integration.tests.ps1\n+     2. Customize TODO sections.\n+     3. Create test DSC Configurtion file MSFT_x<ResourceName>.config.ps1 from integration_config_template.ps1 file.\n+\n+.NOTES\n+   Code in HEADER, FOOTER and DEFAULT TEST regions are standard and may be moved into\n+   DSCResource.Tools in Future and therefore should not be altered if possible.\n+#>\n+\n+# TODO: Customize these paramters...\n+$DSCModuleName      = 'x<ModuleName>' # Example xNetworking\n+$DSCResourceName    = 'MSFT_x<ResourceName>' # Example MSFT_xFirewall\n+# /TODO\n+\n+#region HEADER\n+if ( (-not (Test-Path -Path '.\\DSCResource.Tests\\')) -or `\n+     (-not (Test-Path -Path '.\\DSCResource.Tests\\TestHelper.psm1')) )\n+{\n+    Throw @(\n+        \"The DSCResource.Tests folder could not be found in the root folder of the $DSCModuleName DSC Module to test.\"\n+        \"Please use Git to clone this repository to the root folder of the $DSCModuleName DSC Module that needs to be tested using the command:\"\n+        \"git clone https://github.com/PowerShell/DscResource.Tests.git\"\n+    ) -join \"`n\"\n+}\n+Import-Module .\\DSCResource.Tests\\TestHelper.psm1 -Force\n+$TestEnvironment = Initialize-TestEnvironment `\n+    -DSCModuleName $DSCModuleName `\n+    -DSCResourceName $DSCResourceName `\n+    -TestType Integration \n+#endregion\n+\n+# TODO: Other Init Code Goes Here...\n+\n+# Using try/finally to always cleanup even if something awful happens.\n+try\n+{\n+\n+\n+    #region Integration Tests\n+    <#\n+      This file exists so we can load the test file without necessarily having xNetworking in\n+      the $env:PSModulePath. Otherwise PowerShell will throw an error when reading the Pester File.\n+    #>\n+    $ConfigFile = Join-Path -Path $PSScriptRoot -ChildPath \"$DSCResourceName.config.ps1\"\n+    . $ConfigFile\n+\n+    Describe \"$($DSCResourceName)_Integration\" {\n+        #region DEFAULT TESTS\n+        It 'Should compile without throwing' {\n+            {\n+                [System.Environment]::SetEnvironmentVariable('PSModulePath',\n+                    $env:PSModulePath,[System.EnvironmentVariableTarget]::Machine)\n+                Invoke-Expression -Command \"$($DSCResourceName)_Config -OutputPath `$TestEnvironment.WorkingFolder\"","path":"Templates/integration_template.ps1","position":58,"original_position":58,"commit_id":"ecb70ef9ab9036c288760a76e9fbdf97971a3ae5","original_commit_id":"ecb70ef9ab9036c288760a76e9fbdf97971a3ae5","user":{"login":"KarolKaczmarek","id":6466574,"avatar_url":"https://avatars.githubusercontent.com/u/6466574?v=3","gravatar_id":"","url":"https://api.github.com/users/KarolKaczmarek","html_url":"https://github.com/KarolKaczmarek","followers_url":"https://api.github.com/users/KarolKaczmarek/followers","following_url":"https://api.github.com/users/KarolKaczmarek/following{/other_user}","gists_url":"https://api.github.com/users/KarolKaczmarek/gists{/gist_id}","starred_url":"https://api.github.com/users/KarolKaczmarek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KarolKaczmarek/subscriptions","organizations_url":"https://api.github.com/users/KarolKaczmarek/orgs","repos_url":"https://api.github.com/users/KarolKaczmarek/repos","events_url":"https://api.github.com/users/KarolKaczmarek/events{/privacy}","received_events_url":"https://api.github.com/users/KarolKaczmarek/received_events","type":"User","site_admin":false},"body":"$($DSCResourceName)_Config \r\nis this correct? The configuration in integration_config_template.ps1 seems to be called simply $DSCResourceName","created_at":"2015-11-25T20:15:25Z","updated_at":"2015-11-25T20:15:25Z","html_url":"https://github.com/PowerShell/DscResource.Tests/pull/11#discussion_r45914473","pull_request_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/comments/45914473"},"html":{"href":"https://github.com/PowerShell/DscResource.Tests/pull/11#discussion_r45914473"},"pull_request":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11","id":51482868,"html_url":"https://github.com/PowerShell/DscResource.Tests/pull/11","diff_url":"https://github.com/PowerShell/DscResource.Tests/pull/11.diff","patch_url":"https://github.com/PowerShell/DscResource.Tests/pull/11.patch","issue_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/11","number":11,"state":"open","locked":false,"title":"DSC resource Unit/Template test initialization/tear down functions added","user":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"body":"As discussed in Issue #45 in the xNetworking resource (https://github.com/PowerShell/xNetworking/issues/45).\r\n\r\nThis adds two new functions to TestHelpers.psm1 (the functions contain help and example usage):\r\nInitialize-TestEnvironment\r\nRestore-TestEnvironment\r\n\r\nI've also added the Unit and Integration test templates from the xNetworking module to this repo as well (as they are generic and ideally used with any DSC resource). These templates use the above functions to set up and tear down the environment.\r\n\r\nI have tested this with my fork of the xNetworking repo where I updated the tests to use this helper code instead (see this here: https://github.com/PlagueHO/xNetworking)\r\n\r\n@tysonjhayes, would you mind taking a look at this when you get a chance? It is pretty much the code we've been using in the xNetworking tests. I've also updated my xNetworking fork to use this code as well so it can be PR'd once this PR has gone in.\r\n\r\nCheers!\r\n","created_at":"2015-11-23T02:20:30Z","updated_at":"2015-11-25T20:15:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5b4e09043df8e5b55bd1492e3c6340632b4b009e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11/commits","review_comments_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11/comments","review_comment_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/11/comments","statuses_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/statuses/ecb70ef9ab9036c288760a76e9fbdf97971a3ae5","head":{"label":"PlagueHO:master","ref":"master","sha":"ecb70ef9ab9036c288760a76e9fbdf97971a3ae5","user":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"repo":{"id":46080107,"name":"DscResource.Tests","full_name":"PlagueHO/DscResource.Tests","owner":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PlagueHO/DscResource.Tests","description":"Common meta tests for PowerShell DSC resources repositories.","fork":true,"url":"https://api.github.com/repos/PlagueHO/DscResource.Tests","forks_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/forks","keys_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/teams","hooks_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/hooks","issue_events_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/issues/events{/number}","events_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/events","assignees_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/assignees{/user}","branches_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/branches{/branch}","tags_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/tags","blobs_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/statuses/{sha}","languages_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/languages","stargazers_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/stargazers","contributors_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/contributors","subscribers_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/subscribers","subscription_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/subscription","commits_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/contents/{+path}","compare_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/merges","archive_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/downloads","issues_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/issues{/number}","pulls_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/pulls{/number}","milestones_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/milestones{/number}","notifications_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/labels{/name}","releases_url":"https://api.github.com/repos/PlagueHO/DscResource.Tests/releases{/id}","created_at":"2015-11-12T20:52:02Z","updated_at":"2015-11-12T20:52:03Z","pushed_at":"2015-11-23T21:04:21Z","git_url":"git://github.com/PlagueHO/DscResource.Tests.git","ssh_url":"git@github.com:PlagueHO/DscResource.Tests.git","clone_url":"https://github.com/PlagueHO/DscResource.Tests.git","svn_url":"https://github.com/PlagueHO/DscResource.Tests","homepage":null,"size":52,"stargazers_count":0,"watchers_count":0,"language":"PowerShell","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PowerShell:master","ref":"master","sha":"6588539bf4320d7152962f2c57628d36bb9bb61e","user":{"login":"PowerShell","id":11524380,"avatar_url":"https://avatars.githubusercontent.com/u/11524380?v=3","gravatar_id":"","url":"https://api.github.com/users/PowerShell","html_url":"https://github.com/PowerShell","followers_url":"https://api.github.com/users/PowerShell/followers","following_url":"https://api.github.com/users/PowerShell/following{/other_user}","gists_url":"https://api.github.com/users/PowerShell/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerShell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerShell/subscriptions","organizations_url":"https://api.github.com/users/PowerShell/orgs","repos_url":"https://api.github.com/users/PowerShell/repos","events_url":"https://api.github.com/users/PowerShell/events{/privacy}","received_events_url":"https://api.github.com/users/PowerShell/received_events","type":"Organization","site_admin":false},"repo":{"id":33632903,"name":"DscResource.Tests","full_name":"PowerShell/DscResource.Tests","owner":{"login":"PowerShell","id":11524380,"avatar_url":"https://avatars.githubusercontent.com/u/11524380?v=3","gravatar_id":"","url":"https://api.github.com/users/PowerShell","html_url":"https://github.com/PowerShell","followers_url":"https://api.github.com/users/PowerShell/followers","following_url":"https://api.github.com/users/PowerShell/following{/other_user}","gists_url":"https://api.github.com/users/PowerShell/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerShell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerShell/subscriptions","organizations_url":"https://api.github.com/users/PowerShell/orgs","repos_url":"https://api.github.com/users/PowerShell/repos","events_url":"https://api.github.com/users/PowerShell/events{/privacy}","received_events_url":"https://api.github.com/users/PowerShell/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PowerShell/DscResource.Tests","description":"Common meta tests for PowerShell DSC resources repositories.","fork":false,"url":"https://api.github.com/repos/PowerShell/DscResource.Tests","forks_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/forks","keys_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/teams","hooks_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/hooks","issue_events_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/events{/number}","events_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/events","assignees_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/assignees{/user}","branches_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/branches{/branch}","tags_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/tags","blobs_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/statuses/{sha}","languages_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/languages","stargazers_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/stargazers","contributors_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/contributors","subscribers_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/subscribers","subscription_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/subscription","commits_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/contents/{+path}","compare_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/merges","archive_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/downloads","issues_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues{/number}","pulls_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls{/number}","milestones_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/milestones{/number}","notifications_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/labels{/name}","releases_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/releases{/id}","created_at":"2015-04-08T21:21:19Z","updated_at":"2015-11-21T12:47:34Z","pushed_at":"2015-11-23T21:04:23Z","git_url":"git://github.com/PowerShell/DscResource.Tests.git","ssh_url":"git@github.com:PowerShell/DscResource.Tests.git","clone_url":"https://github.com/PowerShell/DscResource.Tests.git","svn_url":"https://github.com/PowerShell/DscResource.Tests","homepage":null,"size":312,"stargazers_count":9,"watchers_count":9,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":2,"forks":10,"open_issues":2,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11"},"html":{"href":"https://github.com/PowerShell/DscResource.Tests/pull/11"},"issue":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/11"},"comments":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/PowerShell/DscResource.Tests/statuses/ecb70ef9ab9036c288760a76e9fbdf97971a3ae5"}}}}