@@ -125,17 +125,19 @@ public async Task CreateAsync_CreatesNewEntity_WithSpecifiedId()
125125 {
126126 Skip . IfNot ( CanRunLiveTests ( ) ) ;
127127
128+ DateTimeOffset dto = DateTimeOffset . Now ;
128129 IRepository < TEntity > Repository = await GetPopulatedRepositoryAsync ( ) ;
129130 string id = await GetRandomEntityIdAsync ( false ) ;
130131 TEntity addition = TestData . Movies . OfType < TEntity > ( TestData . Movies . BlackPanther , id ) ;
131132 TEntity sut = addition . Clone ( ) ;
132133 await Repository . CreateAsync ( sut ) ;
134+
133135 TEntity actual = await GetEntityAsync ( id ) ;
134136
135137 actual . Should ( ) . BeEquivalentTo < IMovie > ( addition ) ;
136138 actual . Should ( ) . NotBeEquivalentTo < ITableData > ( addition ) . And . HaveEquivalentMetadataTo ( sut ) ;
137139 actual . Id . Should ( ) . Be ( id ) ;
138- actual . UpdatedAt . Should ( ) . BeAfter ( StartTime ) ;
140+ actual . UpdatedAt ? . Ticks . Should ( ) . BeGreaterThan ( dto . Ticks ) ;
139141 actual . Version . Should ( ) . NotBeNullOrEmpty ( ) ;
140142 }
141143
@@ -146,6 +148,7 @@ public async Task CreateAsync_CreatesNewEntity_WithNullId(string id)
146148 {
147149 Skip . IfNot ( CanRunLiveTests ( ) ) ;
148150
151+ DateTimeOffset dto = DateTimeOffset . Now ;
149152 IRepository < TEntity > Repository = await GetPopulatedRepositoryAsync ( ) ;
150153 TEntity addition = TestData . Movies . OfType < TEntity > ( TestData . Movies . BlackPanther ) ;
151154 addition . Id = id ;
@@ -154,7 +157,7 @@ public async Task CreateAsync_CreatesNewEntity_WithNullId(string id)
154157 TEntity actual = await GetEntityAsync ( sut . Id ) ;
155158
156159 actual . Should ( ) . BeEquivalentTo < IMovie > ( addition ) ;
157- actual . UpdatedAt . Should ( ) . BeAfter ( StartTime ) ;
160+ actual . UpdatedAt ? . Ticks . Should ( ) . BeGreaterThan ( dto . Ticks ) ;
158161 }
159162
160163 [ SkippableFact ]
@@ -177,6 +180,7 @@ public async Task CreateAsync_UpdatesMetadata()
177180 {
178181 Skip . IfNot ( CanRunLiveTests ( ) ) ;
179182
183+ DateTimeOffset dto = DateTimeOffset . Now ;
180184 IRepository < TEntity > Repository = await GetPopulatedRepositoryAsync ( ) ;
181185 string id = await GetRandomEntityIdAsync ( false ) ;
182186 TEntity addition = TestData . Movies . OfType < TEntity > ( TestData . Movies . BlackPanther , id ) ;
@@ -190,7 +194,7 @@ public async Task CreateAsync_UpdatesMetadata()
190194 actual . Should ( ) . BeEquivalentTo < IMovie > ( addition ) ;
191195 actual . Should ( ) . NotBeEquivalentTo < ITableData > ( addition ) . And . HaveEquivalentMetadataTo ( sut ) ;
192196 actual . Id . Should ( ) . Be ( id ) ;
193- actual . UpdatedAt . Should ( ) . BeAfter ( StartTime ) ;
197+ actual . UpdatedAt ? . Ticks . Should ( ) . BeGreaterThan ( dto . Ticks ) ;
194198 actual . Version . Should ( ) . NotBeEquivalentTo ( expectedVersion ) ;
195199 }
196200
@@ -295,7 +299,9 @@ public async Task ReadAsync_ReturnsDisconnectedEntity()
295299 TEntity expected = await GetEntityAsync ( id ) ;
296300 TEntity actual = await Repository . ReadAsync ( id ) ;
297301
298- actual . Should ( ) . BeEquivalentTo ( expected ) . And . NotBeSameAs ( expected ) ;
302+ actual . Should ( ) . BeEquivalentTo < IMovie > ( expected ) ;
303+ actual . Should ( ) . HaveEquivalentMetadataTo ( expected ) ;
304+ actual . Should ( ) . NotBeSameAs ( expected ) ;
299305 }
300306
301307 [ SkippableTheory ]
@@ -373,6 +379,7 @@ public async Task ReplaceAsync_Replaces_OnVersionMatch()
373379 {
374380 Skip . IfNot ( CanRunLiveTests ( ) ) ;
375381
382+ DateTimeOffset dto = DateTimeOffset . Now ;
376383 IRepository < TEntity > Repository = await GetPopulatedRepositoryAsync ( ) ;
377384 string id = await GetRandomEntityIdAsync ( true ) ;
378385 TEntity replacement = TestData . Movies . OfType < TEntity > ( TestData . Movies . BlackPanther , id ) ;
@@ -383,14 +390,15 @@ public async Task ReplaceAsync_Replaces_OnVersionMatch()
383390
384391 actual . Should ( ) . BeEquivalentTo < IMovie > ( replacement ) . And . NotBeEquivalentTo < ITableData > ( expected ) ;
385392 actual . Version . Should ( ) . NotBeEquivalentTo ( version ) ;
386- actual . UpdatedAt . Should ( ) . BeAfter ( StartTime ) ;
393+ actual . UpdatedAt ? . Ticks . Should ( ) . BeGreaterThan ( dto . Ticks ) ;
387394 }
388395
389396 [ SkippableFact ]
390397 public async Task ReplaceAsync_Replaces_OnNoVersion ( )
391398 {
392399 Skip . IfNot ( CanRunLiveTests ( ) ) ;
393400
401+ DateTimeOffset dto = DateTimeOffset . Now ;
394402 IRepository < TEntity > Repository = await GetPopulatedRepositoryAsync ( ) ;
395403 string id = await GetRandomEntityIdAsync ( true ) ;
396404 TEntity replacement = TestData . Movies . OfType < TEntity > ( TestData . Movies . BlackPanther , id ) ;
@@ -401,7 +409,8 @@ public async Task ReplaceAsync_Replaces_OnNoVersion()
401409
402410 actual . Should ( ) . BeEquivalentTo < IMovie > ( replacement ) . And . NotBeEquivalentTo < ITableData > ( expected ) ;
403411 actual . Version . Should ( ) . NotBeEquivalentTo ( version ) ;
404- actual . UpdatedAt . Should ( ) . BeAfter ( StartTime ) ;
412+ actual . UpdatedAt ? . Ticks . Should ( ) . BeGreaterThan ( dto . Ticks ) ;
413+
405414 }
406415 #endregion
407416}
0 commit comments