Stephanevg / PSClassUtils

A set of utilities to work with Powershell Classes
http://powershelldistrict.com/how-to-generate-a-uml-diagram-using-powershell/
91 stars 23 forks source link

handle cases when return type is '[void]' or not specified #128

Open Stephanevg opened 3 years ago

Stephanevg commented 3 years ago

When not specified, it should be considuered as VOID.

This is an example of what the current version generates:

#Public Method
    It '[AnsibleVariableCollection] --> SetVariables($Variables) :  - should return type []' {

        # -- Arrange
        [AnsibleVar[]]$Variables = ''

        # -- Act

        $Instance = [AnsibleVariableCollection]::New()
        # -- Assert

        ($Instance.SetVariables($Variables)).GetType().Name | should be 

    } #End It Block

This is what it should actually look like:


#Public Method
    It '[AnsibleVariableCollection] --> SetVariables($Variables) :  - should return type []' {

        # -- Arrange
        $Variables = @()
        $Variables += [AnsibleVar]::New('var1', 'val1', 'host1')
        $Variables += [AnsibleVar]::New('var2', 'val2', 'host2')

        # -- Act

        $Instance = [AnsibleVariableCollection]::New()
        # -- Assert

        $Instance.SetVariables($Variables) | should be $null

    } #End It Block