Исправлены тесты

This commit is contained in:
Alex Shibalkin 2025-02-12 16:17:13 +05:00
parent a9d0fa57f2
commit 77fa9d2c46

View File

@ -2,6 +2,7 @@ using DD.Persistence.Client;
using DD.Persistence.Client.Clients;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Client.Clients.Mapping;
using DD.Persistence.Database.Entity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -13,17 +14,14 @@ namespace DD.Persistence.IntegrationTests.Controllers
public class SetpointControllerTest : BaseIntegrationTest
{
private readonly ISetpointClient setpointClient;
private readonly MappingConfigStorage configStorage;
public SetpointControllerTest(WebAppFactoryFixture factory) : base(factory)
{
var refitClientFactory = scope.ServiceProvider
.GetRequiredService<IRefitClientFactory<IRefitSetpointClient>>();
var logger = scope.ServiceProvider.GetRequiredService<ILogger<SetpointClient>>();
setpointClient = scope.ServiceProvider
.GetRequiredService<ISetpointClient>();
configStorage = (MappingConfigStorage)scope.ServiceProvider.GetRequiredService<IMappingConfigStorage>();
}
@ -32,12 +30,16 @@ namespace DD.Persistence.IntegrationTests.Controllers
{
var id = Guid.Parse("e0fcad22-1761-476e-a729-a3c59d51ba41");
configStorage.AddOrReplace(id, typeof(float));
var config = new Dictionary<Guid, Type>();
config[id] = typeof(float);
var setpointMapper = new SetpointMappingClient(setpointClient, config);
await setpointClient.Add(id, 48.3f, CancellationToken.None);
//act
var response = await setpointClient.GetCurrent([id], CancellationToken.None);
var response = await setpointMapper.GetCurrent([id], CancellationToken.None);
//assert
Assert.NotNull(response);