11using System ;
22using System . Collections . Generic ;
33
4- using FluentAssertions ;
5-
64using Serilog . Sinks . AzureTableStorage . Extensions ;
75
86using Xunit ;
@@ -26,20 +24,20 @@ public void GenerateRowKeyDateTimeOffsetNow()
2624 var dateTime = new DateTimeOffset ( 2024 , 4 , 1 , 23 , 0 , 0 , TimeSpan . FromHours ( - 5 ) ) ;
2725
2826 var rowKey = DefaultKeyGenerator . GenerateRowKey ( dateTime ) ;
29- rowKey . Should ( ) . NotBeNull ( ) ;
27+ Assert . NotNull ( rowKey ) ;
3028
3129 var parsed = Ulid . TryParse ( rowKey , out var ulid ) ;
32- parsed . Should ( ) . BeTrue ( ) ;
33- ulid . Should ( ) . NotBeNull ( ) ;
30+ Assert . True ( parsed ) ;
31+ Assert . NotEqual ( default , ulid ) ;
3432
3533 var reversed = dateTime . ToUniversalTime ( ) . ToReverseChronological ( ) ;
3634 var ulidDate = ulid . Time ;
3735
38- ulidDate . Year . Should ( ) . Be ( reversed . Year ) ;
39- ulidDate . Month . Should ( ) . Be ( reversed . Month ) ;
40- ulidDate . Day . Should ( ) . Be ( reversed . Day ) ;
41- ulidDate . Hour . Should ( ) . Be ( reversed . Hour ) ;
42- ulidDate . Minute . Should ( ) . Be ( reversed . Minute ) ;
36+ Assert . Equal ( reversed . Year , ulidDate . Year ) ;
37+ Assert . Equal ( reversed . Month , ulidDate . Month ) ;
38+ Assert . Equal ( reversed . Day , ulidDate . Day ) ;
39+ Assert . Equal ( reversed . Hour , ulidDate . Hour ) ;
40+ Assert . Equal ( reversed . Minute , ulidDate . Minute ) ;
4341 }
4442
4543
@@ -49,8 +47,8 @@ public void GeneratePartitionKeyDateTimeOffsetNow()
4947 var dateTime = new DateTimeOffset ( 2024 , 4 , 1 , 23 , 0 , 0 , TimeSpan . FromHours ( - 5 ) ) ;
5048
5149 var partitionKey = DefaultKeyGenerator . GeneratePartitionKey ( dateTime ) ;
52- partitionKey . Should ( ) . NotBeNull ( ) ;
53- partitionKey . Should ( ) . Be ( "2516902703999999999" ) ;
50+ Assert . NotNull ( partitionKey ) ;
51+ Assert . Equal ( "2516902703999999999" , partitionKey ) ;
5452 }
5553
5654 [ Fact ]
@@ -60,17 +58,17 @@ public void GeneratePartitionKeyDateTimeNow()
6058 var eventTime = dateTime . UtcDateTime ;
6159
6260 var partitionKey = DefaultKeyGenerator . GeneratePartitionKey ( eventTime ) ;
63- partitionKey . Should ( ) . NotBeNull ( ) ;
64- partitionKey . Should ( ) . Be ( "2516902703999999999" ) ;
61+ Assert . NotNull ( partitionKey ) ;
62+ Assert . Equal ( "2516902703999999999" , partitionKey ) ;
6563 }
6664
6765 [ Theory ]
6866 [ MemberData ( nameof ( GetDateRounding ) ) ]
6967 public void GeneratePartitionKeyDateTimeNowRound ( DateTimeOffset dateTime , string expected )
7068 {
7169 var partitionKey = DefaultKeyGenerator . GeneratePartitionKey ( dateTime ) ;
72- partitionKey . Should ( ) . NotBeNull ( ) ;
73- partitionKey . Should ( ) . Be ( expected ) ;
70+ Assert . NotNull ( partitionKey ) ;
71+ Assert . Equal ( expected , partitionKey ) ;
7472 }
7573
7674 public static IEnumerable < object [ ] > GetDateRounding ( )
@@ -108,8 +106,8 @@ public void GeneratePartitionKeyQueryDateOnly()
108106 var date = new DateOnly ( 2024 , 4 , 1 ) ;
109107
110108 var partitionKeyQuery = DefaultKeyGenerator . GeneratePartitionKeyQuery ( date , TimeSpan . FromHours ( - 5 ) ) ;
111- partitionKeyQuery . Should ( ) . NotBeNull ( ) ;
112- partitionKeyQuery . Should ( ) . Be ( "(PartitionKey ge '2516902667999999999') and (PartitionKey lt '2516903531999999999')" ) ;
109+ Assert . NotNull ( partitionKeyQuery ) ;
110+ Assert . Equal ( "(PartitionKey ge '2516902667999999999') and (PartitionKey lt '2516903531999999999')" , partitionKeyQuery ) ;
113111 }
114112
115113 [ Fact ]
@@ -122,8 +120,8 @@ public void GeneratePartitionKeyQueryDateTime()
122120 var endTime = endDate . UtcDateTime ;
123121
124122 var partitionKeyQuery = DefaultKeyGenerator . GeneratePartitionKeyQuery ( startTime , endTime ) ;
125- partitionKeyQuery . Should ( ) . NotBeNull ( ) ;
126- partitionKeyQuery . Should ( ) . Be ( "(PartitionKey ge '2516902667999999999') and (PartitionKey lt '2516903531999999999')" ) ;
123+ Assert . NotNull ( partitionKeyQuery ) ;
124+ Assert . Equal ( "(PartitionKey ge '2516902667999999999') and (PartitionKey lt '2516903531999999999')" , partitionKeyQuery ) ;
127125 }
128126
129127 [ Fact ]
@@ -133,8 +131,8 @@ public void GeneratePartitionKeyQueryDateTimeOffset()
133131 var endTime = new DateTimeOffset ( 2024 , 4 , 2 , 0 , 0 , 0 , TimeSpan . FromHours ( - 5 ) ) ;
134132
135133 var partitionKeyQuery = DefaultKeyGenerator . GeneratePartitionKeyQuery ( startTime , endTime ) ;
136- partitionKeyQuery . Should ( ) . NotBeNull ( ) ;
137- partitionKeyQuery . Should ( ) . Be ( "(PartitionKey ge '2516902667999999999') and (PartitionKey lt '2516903531999999999')" ) ;
134+ Assert . NotNull ( partitionKeyQuery ) ;
135+ Assert . Equal ( "(PartitionKey ge '2516902667999999999') and (PartitionKey lt '2516903531999999999')" , partitionKeyQuery ) ;
138136 }
139137
140138}
0 commit comments