Update pester syntax to v4 (#11544)

* Capitalize 'Should' command and fix whitespace

```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```

* Capitalise and apply hyphen to 'Not' parameter

```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```

* Capitalise and apply hyphen to 'Be' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```

* Capitalise and apply hyphen to 'BeExactly' parameter

$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'

* Capitalise and apply hyphen to 'BeGreaterThan' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```

* Use 'BeTrue' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```

* Use 'BeFalse' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```

* Capitalise and apply hyphen to 'Match' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```

* Capitalise and apply hyphen to 'Throw' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```

* Capitalise and apply hyphen to 'BeNullOrEmpty' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```

* Capitalise 'Because' parameter

```powershell
$_ -ireplace '\s-because\b',' -Because'
```

* Fix 'BeNullOrEmpty'
This commit is contained in:
xtqqczze authored and Ilya committed 2020-01-11 20:41:59 +05:00
1 parent 70d9ed4d55
commit 743983390e
71 files changed
+979 -979

No files matched your search

@@ -38,7 +38,7 @@ Describe "Measure-Object" -Tags "CI" {
It "Should calculate Standard Deviation with -Sum" {
$actual = ($testObject | Measure-Object -Sum -StandardDeviation)
# We check this way since .StandardDeviation returns a double value
$actual.Sum | Should Be 8
$actual.Sum | Should -Be 8
# 1.52752523165195 was calculated outside powershell using formula from
# http://mathworld.wolfram.com/StandardDeviation.html
[Math]::abs($actual.StandardDeviation - 1.52752523165195) | Should -BeLessThan .00000000000001
@@ -56,8 +56,8 @@ Describe "Measure-Object" -Tags "CI" {
It "Should calculate Standard Deviation with -Sum -Average" {
$actual = ($testObject2 | Measure-Object -Sum -Average -StandardDeviation)
# We check this way since .StandardDeviation returns a double value
$actual.Sum | Should Be 5050
$actual.Average | Should Be 50.5
$actual.Sum | Should -Be 5050
$actual.Average | Should -Be 50.5
# 29.011491975882 was calculated outside powershell using formula from
# http://mathworld.wolfram.com/StandardDeviation.html
[Math]::abs($actual.StandardDeviation - 29.011491975882) | Should -BeLessThan .0000000000001