1
1
using System . Net ;
2
2
using FluentAssertions ;
3
- using FluentAssertions . Extensions ;
4
3
using JsonApiDotNetCore . Configuration ;
5
4
using JsonApiDotNetCore . Serialization . Objects ;
6
5
using Microsoft . AspNetCore . Authentication ;
@@ -12,8 +11,6 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.AtomicOperations.QueryStrings;
12
11
13
12
public sealed class AtomicQueryStringTests : IClassFixture < IntegrationTestContext < TestableStartup < OperationsDbContext > , OperationsDbContext > >
14
13
{
15
- private static readonly DateTime FrozenTime = 30 . July ( 2018 ) . At ( 13 , 46 , 12 ) . AsUtc ( ) ;
16
-
17
14
private readonly IntegrationTestContext < TestableStartup < OperationsDbContext > , OperationsDbContext > _testContext ;
18
15
private readonly OperationsFakers _fakers = new ( ) ;
19
16
@@ -26,11 +23,7 @@ public AtomicQueryStringTests(IntegrationTestContext<TestableStartup<OperationsD
26
23
27
24
testContext . ConfigureServicesAfterStartup ( services =>
28
25
{
29
- services . AddSingleton < ISystemClock > ( new FrozenSystemClock
30
- {
31
- UtcNow = FrozenTime
32
- } ) ;
33
-
26
+ services . AddSingleton < ISystemClock , FrozenSystemClock > ( ) ;
34
27
services . AddResourceDefinition < MusicTrackReleaseDefinition > ( ) ;
35
28
} ) ;
36
29
}
@@ -279,10 +272,12 @@ public async Task Cannot_use_sparse_fieldset_on_operations_endpoint()
279
272
public async Task Can_use_Queryable_handler_on_resource_endpoint ( )
280
273
{
281
274
// Arrange
275
+ var clock = _testContext . Factory . Services . GetRequiredService < ISystemClock > ( ) ;
276
+
282
277
List < MusicTrack > musicTracks = _fakers . MusicTrack . Generate ( 3 ) ;
283
- musicTracks [ 0 ] . ReleasedAt = FrozenTime . AddMonths ( 5 ) ;
284
- musicTracks [ 1 ] . ReleasedAt = FrozenTime . AddMonths ( - 5 ) ;
285
- musicTracks [ 2 ] . ReleasedAt = FrozenTime . AddMonths ( - 1 ) ;
278
+ musicTracks [ 0 ] . ReleasedAt = clock . UtcNow . AddMonths ( 5 ) ;
279
+ musicTracks [ 1 ] . ReleasedAt = clock . UtcNow . AddMonths ( - 5 ) ;
280
+ musicTracks [ 2 ] . ReleasedAt = clock . UtcNow . AddMonths ( - 1 ) ;
286
281
287
282
await _testContext . RunOnDatabaseAsync ( async dbContext =>
288
283
{
0 commit comments