Public/Confirm-PegasusSyncOperationStatistics.tests.ps1
|
BeforeAll { $Script:Module = Import-Module -Name "$PSScriptRoot/../" -Force -PassThru $StartStatistics = @{ "Create person" = -1 "Update person" = -1 "Delete person" = -1 "Create position" = -1 "Update position" = -1 "Delete position" = -1 "Create orgunit" = -1 "Update orgunit" = -1 "Delete orgunit" = -1 "Delete" = -1 "Update" = -1 "Create" = -1 } } Describe "Confirm-PegasusSyncOperationStatistics" { It "Should throw an error when Delete operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics.Delete = 150 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -Delete 100 } | Should -Throw } It "Should not throw an error when Delete operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics.Delete = 80 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -Delete 100 } | Should -Not -Throw } It "Should throw an error when Create operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics.Create = 1200 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -Create 1000 } | Should -Throw } It "Should not throw an error when Create operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics.Create = 800 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -Create 1000 } | Should -Not -Throw } It "Should throw an error when Update operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics.Update = 5000 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -Update 500 } | Should -Throw } It "Should not throw an error when Update operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics.Update = 4500 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -Update 5000 } | Should -Not -Throw } It "Should throw an error when Create person operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Create person" = 50 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -CreatePerson 30 } | Should -Throw } It "Should not throw an error when Create person operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Create person" = 20 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -CreatePerson 30 } | Should -Not -Throw } It "Should throw an error when Update person operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Update person" = 70 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -UpdatePerson 50 } | Should -Throw } It "Should not throw an error when Update person operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Update person" = 40 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -UpdatePerson 50 } | Should -Not -Throw } It "Should throw an error when Delete person operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Delete person" = 25 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -DeletePerson 10 } | Should -Throw } It "Should not throw an error when Delete person operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Delete person" = 5 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -DeletePerson 10 } | Should -Not -Throw } It "Should throw an error when Create position operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Create position" = 40 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -CreatePosition 20 } | Should -Throw } It "Should not throw an error when Create position operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Create position" = 15 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -CreatePosition 20 } | Should -Not -Throw } It "Should throw an error when Update position operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Update position" = 60 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -UpdatePosition 40 } | Should -Throw } It "Should not throw an error when Update position operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Update position" = 30 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -UpdatePosition 40 } | Should -Not -Throw } It "Should throw an error when Delete position operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Delete position" = 15 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -DeletePosition 5 } | Should -Throw } It "Should not throw an error when Delete position operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Delete position" = 3 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -DeletePosition 5 } | Should -Not -Throw } It "Should throw an error when Create orgunit operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Create orgunit" = 30 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -CreateOrgUnit 10 } | Should -Throw } It "Should not throw an error when Create orgunit operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Create orgunit" = 8 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -CreateOrgUnit 10 } | Should -Not -Throw } It "Should throw an error when Update orgunit operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Update orgunit" = 45 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -UpdateOrgUnit 25 } | Should -Throw } It "Should not throw an error when Update orgunit operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Update orgunit" = 20 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -UpdateOrgUnit 25 } | Should -Not -Throw } It "Should throw an error when Delete orgunit operations exceed the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Delete orgunit" = 12 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -DeleteOrgUnit 4 } | Should -Throw } It "Should not throw an error when Delete orgunit operations are within the limit" { $Statistics = $StartStatistics.Clone() $Statistics."Delete orgunit" = 2 { Confirm-PegasusSyncOperationStatistics -Statistics $Statistics -DeleteOrgUnit 4 } | Should -Not -Throw } } |