public/Assert-FootballFixtureGoalMarketTypeProbability.ps1

function Assert-FootballFixtureGoalMarketTypeProbability {

    [CmdletBinding()]
    param(

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [Object]$FixtureMarketType

    )
    process{

        $ErrorActionPreference = 'Stop'

        try {

            foreach ($MartketType in $FixtureMarketType) {

                $FTResult = $($MartketType.FTResult)
                $HomeGoals = $FTResult.split('-')[0]
                $AwayGoals = $FTResult.split('-')[1]

                # 334 Home Over/Under 0.5 Probability
                $HG05GoalObject = $MartketType | Where-Object {$_.TypeId -eq 334}

                if ($($HG05GoalObject.Count) -ge 1)  {

                    $NewHG05GoalObject = $HG05GoalObject.PSObject.Copy()
                    $Correct = 'false'

                    if ($($HG05GoalObject.label) -eq 'Yes' -and $HomeGoals -ge 1) {
                    
                        $Correct = 'true'

                    } # if

                    if ($($HG05GoalObject.label) -eq 'No' -and $HomeGoals -lt 1) {
                    
                        $Correct = 'true'

                    } # if

                    $NewHG05GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                    $NewHG05GoalObject

                } # if

                # 331 Home Over/Under 1.5 Probability
                $HG15GoalObject = $MartketType | Where-Object {$_.TypeId -eq 331}

                if ($($HG15GoalObject.Count) -ge 1)  {

                    $NewHG15GoalObject = $HG15GoalObject.PSObject.Copy()
                    $Correct = 'false'

                    if ($($NewHG15GoalObject.label) -eq 'Yes' -and $HomeGoals -ge 2) {
                    
                        $Correct = 'true'

                    } # if

                    if ($($NewHG15GoalObject.label) -eq 'No' -and $HomeGoals -lt 2) {
                    
                        $Correct = 'true'

                    } # if

                    $NewHG15GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                    $NewHG15GoalObject

                } # if

                 # 330 Home Over/Under 2.5 Probability
                 $HG25GoalObject = $MartketType | Where-Object {$_.TypeId -eq 330}

                if ($($HG25GoalObject.Count) -ge 1)  {
 
                    $NewHG25GoalObject = $HG25GoalObject.PSObject.Copy()
                    $Correct = 'false'
 
                    if ($($NewHG25GoalObject.label) -eq 'Yes' -and $HomeGoals -ge 3) {
                     
                        $Correct = 'true'
 
                    } # if
 
                    if ($($NewHG25GoalObject.label) -eq 'No' -and $HomeGoals -lt 3) {
                     
                        $Correct = 'true'
 
                    } # if
 
                    $NewHG25GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                    $NewHG25GoalObject
 
                } # if

                 # 326 Home Over/Under 3.5 Probability
                 $HG35GoalObject = $MartketType | Where-Object {$_.TypeId -eq 326}

                if ($($HG35GoalObject.Count) -ge 1)  {
 
                     $NewHG35GoalObject = $HG35GoalObject.PSObject.Copy()
                     $Correct = 'false'
 
                     if ($($NewHG35GoalObject.label) -eq 'Yes' -and $HomeGoals -ge 4) {
                     
                         $Correct = 'true'
 
                     } # if
 
                     if ($($NewHG35GoalObject.label) -eq 'No' -and $HomeGoals -lt 4) {
                     
                         $Correct = 'true'
 
                     } # if
 
                     $NewHG35GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                     $NewHG35GoalObject
 
                } # if

                # --------------------------------------------------

                # 334 Away Over/Under 0.5 Probability
                $AG05GoalObject = $MartketType | Where-Object {$_.TypeId -eq 333}

                if ($($AG05GoalObject.Count) -ge 1)  {

                    $NewAG05GoalObject = $AG05GoalObject.PSObject.Copy()
                    $Correct = 'false'

                    if ($($AG05GoalObject.label) -eq 'Yes' -and $AwayGoals -ge 1) {
                    
                        $Correct = 'true'

                    } # if

                    if ($($AG05GoalObject.label) -eq 'No' -and $AwayGoals -lt 1) {
                    
                        $Correct = 'true'

                    } # if

                    $NewAG05GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                    $NewAG05GoalObject

                } # if

                # 331 Away Over/Under 1.5 Probability
                $AG15GoalObject = $MartketType | Where-Object {$_.TypeId -eq 332}

                if ($($AG15GoalObject.Count) -ge 1)  {

                    $NewAG15GoalObject = $AG15GoalObject.PSObject.Copy()
                    $Correct = 'false'

                    if ($($NewAG15GoalObject.label) -eq 'Yes' -and $AwayGoals -ge 2) {
                    
                        $Correct = 'true'

                    } # if

                    if ($($NewAG15GoalObject.label) -eq 'No' -and $AwayGoals -lt 2) {
                    
                        $Correct = 'true'

                    } # if

                    $NewAG15GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                    $NewAG15GoalObject

                } # if

                 # 328 Away Over/Under 2.5 Probability
                 $AG25GoalObject = $MartketType | Where-Object {$_.TypeId -eq 328}

                 if ($($AG25GoalObject.Count) -ge 1)  {
 
                     $NewAG25GoalObject = $AG25GoalObject.PSObject.Copy()
                     $Correct = 'false'
 
                     if ($($NewAG25GoalObject.label) -eq 'Yes' -and $AwayGoals -ge 3) {
                     
                         $Correct = 'true'
 
                     } # if
 
                     if ($($NewAG25GoalObject.label) -eq 'No' -and $AwayGoals -lt 3) {
                     
                         $Correct = 'true'
 
                     } # if
 
                     $NewAG25GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                     $NewAG25GoalObject
 
                 } # if

                 # 327 Away Over/Under 3.5 Probability
                 $AG35GoalObject = $MartketType | Where-Object {$_.TypeId -eq 327}

                 if ($($AG35GoalObject.Count) -ge 1)  {
 
                     $NewAG35GoalObject = $AG35GoalObject.PSObject.Copy()
                     $Correct = 'false'
 
                     if ($($NewAG35GoalObject.label) -eq 'Yes' -and $AwayGoals -ge 4) {
                     
                         $Correct = 'true'
 
                     } # if
 
                     if ($($NewAG35GoalObject.label) -eq 'No' -and $AwayGoals -lt 4) {
                     
                         $Correct = 'true'
 
                     } # if
 
                     $NewAG35GoalObject | Add-Member -MemberType NoteProperty -Name Correct -Value $Correct
                     $NewAG35GoalObject
 
                 } # if

            } # foreach

        }
        catch {

            $_.Exception.Message

        } # try catch

    } # process

} # function