private ValidationResult ValidateFixtureChangeType(fixture_change message) { if (message.change_typeSpecified && !MessageMapperHelper.IsEnumMember <FixtureChangeType>(message.change_type)) { return(ValidationResult.PROBLEMS_DETECTED); } return(ValidationResult.SUCCESS); }
/// <summary> /// Validates the provided <see cref="fixture_change" /> message /// </summary> /// <param name="message">The <see cref="fixture_change" /> message to validate</param> /// <returns>The <see cref="ValidationResult" /> specifying the result of validation</returns> protected ValidationResult ValidateFixtureChange(fixture_change message) { Contract.Requires(message != null); ValidateMessageProducer(message); if (!ValidateMessage(message)) { return(ValidationResult.FAILURE); } if (message.change_typeSpecified && !MessageMapperHelper.IsEnumMember <FixtureChangeType>(message.change_type)) { LogWarning(message, "change_type", message.change_type); return(ValidationResult.PROBLEMS_DETECTED); } return(ValidationResult.SUCCESS); }
/// <summary> /// Validates the provided <see cref="fixture_change" /> message /// </summary> /// <param name="message">The <see cref="fixture_change" /> message to validate</param> /// <returns>The <see cref="ValidationResult" /> specifying the result of validation</returns> protected ValidationResult ValidateFixtureChange(fixture_change message) { Guard.Argument(message, nameof(message)).NotNull(); ValidateMessageProducer(message); if (!ValidateMessage(message)) { return(ValidationResult.FAILURE); } if (message.change_typeSpecified && !MessageMapperHelper.IsEnumMember <FixtureChangeType>(message.change_type)) { LogWarning(message, "change_type", message.change_type); return(ValidationResult.PROBLEMS_DETECTED); } return(ValidationResult.SUCCESS); }
/// <summary> /// Validates the provided <see cref="odds_change" /> message /// </summary> /// <param name="message">The <see cref="odds_change" /> message to validate</param> /// <returns>The <see cref="ValidationResult" /> specifying the result of validation</returns> protected ValidationResult ValidateOddsChange(odds_change message) { Contract.Requires(message != null); ValidateMessageProducer(message); if (!ValidateMessage(message)) { return(ValidationResult.FAILURE); } var result = ValidationResult.SUCCESS; if (message.odds_change_reasonSpecified && !MessageMapperHelper.IsEnumMember <OddsChangeReason>(message.odds_change_reason)) { LogWarning(message, "odds_change_reason", message.odds_change_reason); result = ValidationResult.PROBLEMS_DETECTED; } if (message.odds == null) { return(result); } if (message.odds.betstop_reasonSpecified && !_namedValuesProvider.BetStopReasons.IsValueDefined(message.odds.betstop_reason)) { LogWarning(message, "betstop_reason", message.odds.betstop_reason); result = ValidationResult.PROBLEMS_DETECTED; } if (message.odds.betting_statusSpecified && !_namedValuesProvider.BettingStatuses.IsValueDefined(message.odds.betting_status)) { LogWarning(message, "betting_status", message.odds.betting_status); result = ValidationResult.PROBLEMS_DETECTED; } if (message.odds.market == null || !message.odds.market.Any()) { return(result); } for (var marketIndex = 0; marketIndex < message.odds.market.Length; marketIndex++) { var market = message.odds.market[marketIndex]; if (market.statusSpecified && !MessageMapperHelper.IsEnumMember <MarketStatus>(market.status)) { LogFailure(message, $"market[{marketIndex}].market_status", market.status); return(ValidationResult.FAILURE); } //if (market.favouriteSpecified && market.favourite != 1) //{ // LogWarning(message, $"market[{marketIndex}].favourite", market.favourite); // result = ValidationResult.PROBLEMS_DETECTED; //} if (!ValidateSpecifiers(message, market, marketIndex)) { result = ValidationResult.PROBLEMS_DETECTED; } if (!CheckSpecifiersAsync(message.ProducerId, market.id, market.Specifiers).Result) { result = ValidationResult.PROBLEMS_DETECTED; } if (market.outcome == null || !market.outcome.Any()) { continue; } for (var outcomeIndex = 0; outcomeIndex < market.outcome.Length; outcomeIndex++) { var outcome = market.outcome[outcomeIndex]; result = ValidateOddsChangeOutcomes(message, market, outcome, result); } } return(result); }
/// <summary> /// Validates the provided <see cref="odds_change" /> message /// </summary> /// <param name="message">The <see cref="odds_change" /> message to validate</param> /// <returns>The <see cref="ValidationResult" /> specifying the result of validation</returns> protected ValidationResult ValidateOddsChange(odds_change message) { Guard.Argument(message, nameof(message)).NotNull(); ValidateMessageProducer(message); if (!ValidateMessage(message)) { return(ValidationResult.FAILURE); } var result = ValidationResult.SUCCESS; if (message.odds_change_reasonSpecified && !MessageMapperHelper.IsEnumMember <OddsChangeReason>(message.odds_change_reason)) { LogWarning(message, "odds_change_reason", message.odds_change_reason); result = ValidationResult.PROBLEMS_DETECTED; } if (message.odds == null) { return(result); } if (message.odds.betstop_reasonSpecified && !_namedValuesProvider.BetStopReasons.IsValueDefined(message.odds.betstop_reason)) { LogWarning(message, "betstop_reason", message.odds.betstop_reason); result = ValidationResult.PROBLEMS_DETECTED; } if (message.odds.betting_statusSpecified && !_namedValuesProvider.BettingStatuses.IsValueDefined(message.odds.betting_status)) { LogWarning(message, "betting_status", message.odds.betting_status); result = ValidationResult.PROBLEMS_DETECTED; } if (message.odds.market == null || !message.odds.market.Any()) { return(result); } foreach (var market in message.odds.market) { if (market.statusSpecified && !MessageMapperHelper.IsEnumMember <MarketStatus>(market.status)) { LogFailure(message, $"market {market.id} market_status", market.status); return(ValidationResult.FAILURE); } if (!ValidateSpecifiers(message, market, market.id)) { result = ValidationResult.PROBLEMS_DETECTED; } if (!CheckSpecifiersAsync(message.ProducerId, market.id, market.Specifiers).Result) { result = ValidationResult.PROBLEMS_DETECTED; } if (market.outcome == null || !market.outcome.Any()) { continue; } foreach (var outcome in market.outcome) { result = ValidateOddsChangeOutcomes(message, market, outcome, result); } } return(result); }