public void Should_choose_correct_verdict_for_many_replicas_with_exhausted_status(ResponseCode responseCode1, ResponseCode responseCode2, ResultReason result)
        {
            var replicaResults = new List <ReplicaResult>
            {
                CreateRejectReplicaResult(responseCode1, cleanHeaders),
                CreateRejectReplicaResult(responseCode2, cleanHeaders)
            };

            var clusterResult = new ClusterResult(ClusterResultStatus.ReplicasExhausted, replicaResults, null, request);

            ClusterResultsAnalyzer.FindResultReason(clusterResult).Should().Be(result);
        }
        public void Should_choose_correct_verdict_for_throttling_depends_on_header(bool withSingularThrottlingTriggerHeader, ResultReason result)
        {
            var replicaResults = new List <ReplicaResult>
            {
                CreateRejectReplicaResult(
                    ResponseCode.TooManyRequests,
                    withSingularThrottlingTriggerHeader ? xSingularThrottlingTriggerHeaders : cleanHeaders
                    )
            };

            var clusterResult = new ClusterResult(ClusterResultStatus.ReplicasExhausted, replicaResults, null, request);

            ClusterResultsAnalyzer.FindResultReason(clusterResult).Should().Be(result);
        }
        public void Should_choose_correct_verdict_when_answers_is_empty_depends_on_status(ClusterResultStatus status, ResultReason result)
        {
            var emptyReplicaResults = new List <ReplicaResult>();
            var clusterResult       = new ClusterResult(status, emptyReplicaResults, null, request);

            ClusterResultsAnalyzer.FindResultReason(clusterResult).Should().Be(result);
        }
Exemplo n.º 4
0
 public void RecordRequest(ResultReason reason)
 {
     requestReasonsCounter.For(reason.ToString()).Add(1);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the value of a tag in the format of a <see cref="ResultReason" />.
 /// </summary>
 /// <param name="gameTag">The tag.</param>
 /// <param name="reason">The result reason.</param>
 public static void SetResultReasonValue(this GameTag gameTag, ResultReason reason) =>
 gameTag.Value = reason.ToResultReasonString();
Exemplo n.º 6
0
 /// <summary>
 /// Try to convert the string to a <see cref="ResultReason"/>.
 /// </summary>
 /// <param name="resultReason">The result reason enum value.</param>
 /// <returns>The string value for the <see cref="ResultReason"/>.</returns>
 public static string ToResultReasonString(this ResultReason resultReason) => resultReason switch
 {