mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
18 lines
864 B
PowerShell
18 lines
864 B
PowerShell
Describe 'ConvertTo-Json' -tags "CI" {
|
|
It 'Newtonsoft.Json.Linq.Jproperty should be converted to Json properly' {
|
|
$EgJObject = New-Object -TypeName Newtonsoft.Json.Linq.JObject
|
|
$EgJObject.Add("TestValue1", "123456")
|
|
$EgJObject.Add("TestValue2", "78910")
|
|
$EgJObject.Add("TestValue3", "99999")
|
|
$dict = @{}
|
|
$dict.Add('JObject', $EgJObject)
|
|
$dict.Add('StrObject', 'This is a string Object')
|
|
$properties = @{'DictObject' = $dict; 'RandomString' = 'A quick brown fox jumped over the lazy dog'}
|
|
$object = New-Object -TypeName psobject -Property $properties
|
|
$jsonFormat = ConvertTo-Json -InputObject $object
|
|
$jsonFormat | Should Match '"TestValue1": 123456'
|
|
$jsonFormat | Should Match '"TestValue2": 78910'
|
|
$jsonFormat | Should Match '"TestValue3": 99999'
|
|
}
|
|
}
|