This commit is contained in:
parent
c9405bf64a
commit
21664d1e16
@ -1,23 +1,17 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using DD.Persistence.Client;
|
||||
using DD.Persistence.Client.Clients.Interfaces;
|
||||
using DD.Persistence.Database.Model;
|
||||
using System.Net;
|
||||
using Xunit;
|
||||
using DD.Persistence.Client.Clients.Interfaces.Refit;
|
||||
using DD.Persistence.Client.Clients;
|
||||
using DD.Persistence.Client.Clients.Interfaces;
|
||||
using DD.Persistence.Client.Clients.Interfaces.Refit;
|
||||
using DD.Persistence.Database.Model;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Xunit;
|
||||
|
||||
namespace DD.Persistence.IntegrationTests.Controllers
|
||||
{
|
||||
public class SetpointControllerTest : BaseIntegrationTest
|
||||
{
|
||||
private readonly ISetpointClient setpointClient;
|
||||
private class TestObject
|
||||
{
|
||||
public string? Value1 { get; set; }
|
||||
public int? Value2 { get; set; }
|
||||
}
|
||||
public SetpointControllerTest(WebAppFactoryFixture factory) : base(factory)
|
||||
{
|
||||
var refitClientFactory = scope.ServiceProvider
|
||||
@ -153,7 +147,7 @@ namespace DD.Persistence.IntegrationTests.Controllers
|
||||
|
||||
await Add();
|
||||
|
||||
var dateBegin = DateTimeOffset.MinValue;
|
||||
var dateBegin = DateTimeOffset.UtcNow.AddDays(-1);
|
||||
var take = 1;
|
||||
var part = await setpointClient.GetPart(dateBegin, take, CancellationToken.None);
|
||||
|
||||
@ -164,14 +158,17 @@ namespace DD.Persistence.IntegrationTests.Controllers
|
||||
Assert.NotNull(response);
|
||||
|
||||
var expectedValue = part!
|
||||
.FirstOrDefault()!.Created
|
||||
.ToString("dd.MM.yyyy-HH:mm:ss");
|
||||
.FirstOrDefault()!.Timestamp
|
||||
.ToUniversalTime()
|
||||
.ToString();
|
||||
var actualValueFrom = response.From
|
||||
.ToString("dd.MM.yyyy-HH:mm:ss");
|
||||
.ToUniversalTime()
|
||||
.ToString();
|
||||
Assert.Equal(expectedValue, actualValueFrom);
|
||||
|
||||
var actualValueTo = response.To
|
||||
.ToString("dd.MM.yyyy-HH:mm:ss");
|
||||
.ToUniversalTime()
|
||||
.ToString();
|
||||
Assert.Equal(expectedValue, actualValueTo);
|
||||
}
|
||||
|
||||
@ -216,7 +213,7 @@ namespace DD.Persistence.IntegrationTests.Controllers
|
||||
{
|
||||
//arrange
|
||||
var setpointKey = Guid.NewGuid();
|
||||
var setpointValue = new TestObject()
|
||||
var setpointValue = new
|
||||
{
|
||||
Value1 = "1",
|
||||
Value2 = 2
|
||||
|
@ -8,7 +8,7 @@ public class SetpointLogDto : SetpointValueDto
|
||||
/// <summary>
|
||||
/// Дата сохранения уставки
|
||||
/// </summary>
|
||||
public DateTimeOffset Created { get; set; }
|
||||
public DateTimeOffset Timestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ключ пользователя
|
||||
|
@ -96,7 +96,7 @@ namespace DD.Persistence.Repository.Repositories
|
||||
Key = setpointKey,
|
||||
Value = newValue,
|
||||
IdUser = idUser,
|
||||
Timestamp = DateTimeOffset.UtcNow
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUniversalTime()
|
||||
};
|
||||
|
||||
await db.Set<Setpoint>().AddAsync(entity, token);
|
||||
|
Loading…
Reference in New Issue
Block a user