I'm attempting to test a PowerShell command (Set-PropertyValue) that sets a property value of a SharePoint list item.  The function use the Invoke-WebMethod function do to the actual work.
My current Set-PropertyValue.Test.ps1 file:
# include stuff omitted
Describe 'Set-PropertyValue' {
  #
  # arrange
  #
  # set $url, $list, $id, $property variables
  ...
  # the value that it should be 
  $expected=10.5
  BeforeEach {
    # get the property's current value
    $original = Get-PropertyValue $url $list $id $property
  }
  AfterEach {
    # restore original value
    Set-PropertyValue $url $list $id $property $original
  }
  It "Should set a property's value" {
    #
    # act
    #
    # update property's value
    $response = Set-PropertyValue $url $list $id $property $expected
    # get the new value
    $actual = Get-PropertyValue $url $list $id $property
    #
    # assert
    #
    $response.statuscode | should be 204 # no content
    $actual | Should Be $expected
  } # It
} # Describe
I don't like this for a number of reasons:
- external dependence upon 
Get-PropertyValue - no test isolation; changes are made to SharePoint list
 - potential to level list item in undesirable state
 - test not structured to test multiple properties easily, in a loop perhaps
 
Is there a better way to test this?
                        
One approach:
Functions)PsFoo.psm1); 'dot-source' each of the command's script files (e.g.Functions\Invoke-Foo.ps1), but exclude the unit-test file (e.g.Functions\Invoke-Foo.Tests.ps1).PsFoo.Tests.ps1) that 'dot-sources' the module file and contains all of the integration tests.PS> Invoke-Pesterwill run the integration tests (inPsFoo.Tests.ps1) and the unit tests (inFunctions\*.Tests.ps1).