Files
ThompsonNye db791a1183
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Add endpoint to query the system's current time
2025-10-16 17:23:47 +02:00

32 lines
875 B
C#

using FluentAssertions;
using FluentAssertions.Extensions;
using System.Net.Http.Json;
using Vegasco.Server.Api.Info;
namespace Vegasco.Server.Api.Tests.Integration.Info;
[Collection(SharedTestCollection.Name)]
public sealed class GetCurrentTimeTests
{
private readonly WebAppFactory _factory;
public GetCurrentTimeTests(WebAppFactory factory)
{
_factory = factory;
}
[Fact]
public async Task GetServerInfo_ShouldReturnServerInfo_WhenCalled()
{
// Arrange
// Act
using HttpResponseMessage response = await _factory.HttpClient.GetAsync("/v1/info/time");
// Assert
response.IsSuccessStatusCode.Should().BeTrue();
GetCurrentTime.Response? timeInfo = await response.Content.ReadFromJsonAsync<GetCurrentTime.Response>();
timeInfo.Should().NotBeNull();
timeInfo.CurrentTime.Should().BeCloseTo(DateTimeOffset.UtcNow, TimeSpan.FromSeconds(10));
}
}