Внести правки по результатам ревью #2

This commit is contained in:
Roman Efremov 2024-11-25 10:30:37 +05:00
parent c496cea07a
commit 4fa00de88e
2 changed files with 4 additions and 3 deletions

View File

@ -49,7 +49,7 @@ namespace Persistence.IntegrationTests.Controllers
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content); Assert.NotNull(response.Content);
Assert.NotEmpty(response.Content); Assert.NotEmpty(response.Content);
Assert.Equal(response.Content.FirstOrDefault()?.Key, setpointKey); Assert.Equal(setpointKey, response.Content.FirstOrDefault()?.Key);
} }
[Fact] [Fact]
@ -87,7 +87,7 @@ namespace Persistence.IntegrationTests.Controllers
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content); Assert.NotNull(response.Content);
Assert.NotEmpty(response.Content); Assert.NotEmpty(response.Content);
Assert.Equal(response.Content.FirstOrDefault()?.Key, setpointKey); Assert.Equal(setpointKey, response.Content.FirstOrDefault()?.Key);
} }
[Fact] [Fact]
@ -122,7 +122,7 @@ namespace Persistence.IntegrationTests.Controllers
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content); Assert.NotNull(response.Content);
Assert.NotEmpty(response.Content); Assert.NotEmpty(response.Content);
Assert.Equal(response.Content.FirstOrDefault().Value.FirstOrDefault()?.Key, setpointKey); Assert.Equal(setpointKey, response.Content.FirstOrDefault()?.Key);
} }
[Fact] [Fact]

View File

@ -35,6 +35,7 @@ namespace Persistence.Repository.Repositories
.ToArrayAsync(token); .ToArrayAsync(token);
var filteredEntities = entities var filteredEntities = entities
.GroupBy(e => e.Key) .GroupBy(e => e.Key)
.Select(e => e.OrderBy(o => o.Created))
.Select(e => e.Where(e => e.Created <= historyMoment).Last()); .Select(e => e.Where(e => e.Created <= historyMoment).Last());
var dtos = filteredEntities var dtos = filteredEntities
.Select(e => e.Adapt<SetpointValueDto>()); .Select(e => e.Adapt<SetpointValueDto>());