Исправлены тесты
This commit is contained in:
parent
a9d0fa57f2
commit
77fa9d2c46
@ -2,6 +2,7 @@ using DD.Persistence.Client;
|
|||||||
using DD.Persistence.Client.Clients;
|
using DD.Persistence.Client.Clients;
|
||||||
using DD.Persistence.Client.Clients.Interfaces;
|
using DD.Persistence.Client.Clients.Interfaces;
|
||||||
using DD.Persistence.Client.Clients.Interfaces.Refit;
|
using DD.Persistence.Client.Clients.Interfaces.Refit;
|
||||||
|
using DD.Persistence.Client.Clients.Mapping;
|
||||||
using DD.Persistence.Database.Entity;
|
using DD.Persistence.Database.Entity;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@ -13,17 +14,14 @@ namespace DD.Persistence.IntegrationTests.Controllers
|
|||||||
public class SetpointControllerTest : BaseIntegrationTest
|
public class SetpointControllerTest : BaseIntegrationTest
|
||||||
{
|
{
|
||||||
private readonly ISetpointClient setpointClient;
|
private readonly ISetpointClient setpointClient;
|
||||||
private readonly MappingConfigStorage configStorage;
|
|
||||||
public SetpointControllerTest(WebAppFactoryFixture factory) : base(factory)
|
public SetpointControllerTest(WebAppFactoryFixture factory) : base(factory)
|
||||||
{
|
{
|
||||||
var refitClientFactory = scope.ServiceProvider
|
var refitClientFactory = scope.ServiceProvider
|
||||||
.GetRequiredService<IRefitClientFactory<IRefitSetpointClient>>();
|
.GetRequiredService<IRefitClientFactory<IRefitSetpointClient>>();
|
||||||
var logger = scope.ServiceProvider.GetRequiredService<ILogger<SetpointClient>>();
|
|
||||||
|
|
||||||
setpointClient = scope.ServiceProvider
|
setpointClient = scope.ServiceProvider
|
||||||
.GetRequiredService<ISetpointClient>();
|
.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");
|
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);
|
await setpointClient.Add(id, 48.3f, CancellationToken.None);
|
||||||
|
|
||||||
//act
|
//act
|
||||||
var response = await setpointClient.GetCurrent([id], CancellationToken.None);
|
var response = await setpointMapper.GetCurrent([id], CancellationToken.None);
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
Assert.NotNull(response);
|
Assert.NotNull(response);
|
||||||
|
Loading…
Reference in New Issue
Block a user