public void Should_deserialize_rate_limit() { var response = CreateResponseMessage(string.Empty); var actual = RateLimitApiException.CreateAsync(response).GetAwaiter().GetResult(); actual.RateLimit.Should().BeEquivalentTo(new RateLimit { Limit = 10, Remaining = 5, Reset = new DateTimeOffset(2020, 3, 31, 22, 38, 58, TimeSpan.Zero) }); }
public void Should_deserialize_api_error_like_brute_force_response_from_auth_api() { var response = CreateResponseMessage( @"{ ""error"": ""too_many_attempts"", ""error_description"": ""Your account has been blocked after multiple consecutive login attempts. We've sent you an email with instructions on how to unblock it."" }" ); var actual = RateLimitApiException.CreateAsync(response).GetAwaiter().GetResult(); actual.ApiError.Error.Should().BeEquivalentTo("too_many_attempts"); actual.ApiError.Message.Should().BeEquivalentTo("Your account has been blocked after multiple consecutive login attempts. We've sent you an email with instructions on how to unblock it."); }