Open
Description
When you have a method in your class and in return value you put [System.String] or [System.Int32] (probably the others too) if you generate the tests pester it puts errors when you play them
Describing [Date]-[Methods]
[-] [Date] --> MethodTest($Message) : [System.String] - should return type [System.String]
Expected strings to be the same, but they were different.
Expected length: 13
Actual length: 6
Strings differ at index 1.
Expected: 'System.String'
But was: 'String'
83: ($Instance.MethodTest($Message)).GetType().Name | should be System.String
in the pester file you have
#Public Method
It '[Date] --> MethodTest($Message) : [System.String] - should return type [System.String]' {
# -- Arrange
[System.String]$Message = "test"
# -- Act
$Instance = [Date]::New()
# -- Assert
($Instance.MethodTest($Message)).GetType().Name | should be System.String
} #End It Block`
and my method is
[System.String] MethodTest ([System.String]$Message) {
return "Mon message est : $($Message)"
}
Actually, the return is a String type and not [System.String]
PS > ($date.MethodTest("test")).gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object
I think that the solution would be to add in the Write-CUPesterTest a transformation so that if it finds [System.XXXX] it transforms it into [XXXX] in pester test
Metadata
Metadata
Assignees
Labels
No labels