32 lines
875 B
C#
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));
|
|||
|
|
}
|
|||
|
|
}
|