Update README.md with additional SonarCloud badges and improve CI workflow for coverage reporting
ci / build-backend (push) Successful in 2m34s
ci / build-frontend (push) Successful in 41s
ci / tests (push) Successful in 2m55s
ci / sonar (push) Successful in 5m21s

Enhanced the README.md file by adding new SonarCloud badges for coverage, bugs, code smells, security rating, and maintainability rating. Updated the CI workflow to remove coverage collection from the test step, as it is now handled by SonarCloud, streamlining the process and ensuring accurate badge representation.
This commit is contained in:
Leonid Pershin
2026-07-27 03:19:18 +03:00
parent 464355434b
commit 790d01b587
22 changed files with 2891 additions and 99 deletions
@@ -0,0 +1,49 @@
using System.Net;
using System.Text;
namespace TeleWave.Application.Tests.TestSupport;
/// <summary>
/// Фабрика HTTP-клиентов поверх подставного обработчика: наружу запрос не уходит, ответ выбирается
/// по URL. Запрошенные адреса копятся в <see cref="Urls"/> — по ним проверяем, что провайдер собрал
/// правильный запрос (сегмент tv/movie, язык, append_to_response).
/// </summary>
internal sealed class FakeHttpClientFactory(Func<string, HttpResponseMessage> respond)
: IHttpClientFactory
{
public List<string> Urls { get; } = [];
/// <summary>Один и тот же JSON на любой запрос — самый частый случай в тестах.</summary>
public static FakeHttpClientFactory Json(string json) => new(_ => Ok(json));
/// <summary>Ответ-ошибка: провайдеры обязаны деградировать в null/пустой список.</summary>
public static FakeHttpClientFactory Failing(
HttpStatusCode status = HttpStatusCode.ServiceUnavailable
) => new(_ => new HttpResponseMessage(status) { Content = new StringContent("{}") });
public static HttpResponseMessage Ok(string json) =>
new(HttpStatusCode.OK)
{
Content = new StringContent(json, Encoding.UTF8, "application/json"),
};
public HttpClient CreateClient(string name) =>
new(
new StubHandler(url =>
{
Urls.Add(url);
return respond(url);
})
);
/// <summary>Последний запрошенный адрес — короче, чем каждый раз доставать из списка.</summary>
public string LastUrl => Urls.Count > 0 ? Urls[^1] : string.Empty;
private sealed class StubHandler(Func<string, HttpResponseMessage> respond) : HttpMessageHandler
{
protected override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request,
CancellationToken cancellationToken
) => Task.FromResult(respond(request.RequestUri!.ToString()));
}
}