using JSMR.Infrastructure.Http;
using NSubstitute;
using System.Net;

namespace JSMR.Tests.Extensions;

internal static class HttpServiceTestExtensions
{
    public static void ReturnsContent(this IHttpService httpService, string content, HttpStatusCode statusCode = HttpStatusCode.OK)
    {
        HttpStringResponse response = new()
        {
            StatusCode = statusCode,
            Content = content
        };

        httpService.GetAsync(Arg.Any<string>(), Arg.Any<CancellationToken>())
            .Returns(Task.FromResult(response));
    }
}