/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/powershell/Language/Scripting/DeserializedMethods.Tests.ps1
21 строка
793 B
Steve Lee
Update copyright notice to latest guidance (#12190)
24 мар 2020, 21:08
Не верифицирован
24 мар 2020, 21:08
b7cb335
Код
Авторство
О чём код?
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. Describe "DeserializedMethods" -Tags "CI" { It "Deserialized objects shouldn't ever have any methods (unless they are primitive known types)" { $a = [collections.arraylist]::new() $null = $a.Add(1) $null = $a.Add(2) $null = $a.Add(3) # using linkedlist that implements IEnumerable, # but doesn't implement IList or IList<T> $x = [collections.generic.linkedlist[int]]::new() $null = $x.Add(123) $null = $x.Add(456) $s = [System.Management.Automation.PSSerializer]::Serialize($x) $d = [System.Management.Automation.PSSerializer]::Deserialize($s) $d | Get-Member -MemberType *Method* Add | Should -BeNullOrEmpty } }