📄 tests/Integrations/Smhi/SmhiClientTests/IntegrationTests.cs
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shouldly;

namespace MMirror.Integrations.Smhi.Tests.SmhiClientTests;

[TestClass]
public sealed class IntegrationTests
{
    [TestMethod]
    public async Task IntegrationTest()
    {
        var host = Host.CreateApplicationBuilder();
        host.Services.AddSmhiServices();
        var app = host.Build();
        var client = app.Services.GetRequiredService<SmhiClient>();
        var forecast = await client.GetPointForecast(12.0, 57.7, CancellationToken.None);

        forecast.Now.Forecast.TemperatureCelsius.ShouldBeInRange(-50, 50);
        forecast.Now.PeriodName.ShouldNotBeNullOrWhiteSpace();
        forecast.Next.PeriodName.ShouldNotBeNullOrWhiteSpace();
        forecast.Following.PeriodName.ShouldNotBeNullOrWhiteSpace();
        forecast.Next.Forecast.ValidTime.ShouldBeGreaterThan(forecast.Now.Forecast.ValidTime);
        forecast.Following.Forecast.ValidTime.ShouldBeGreaterThan(forecast.Next.Forecast.ValidTime);
    }
}