22using Arius . Core . Models ;
33using Arius . Core . Repositories ;
44using Arius . Core . Services ;
5- using FluentAssertions ;
65using Microsoft . Extensions . Logging . Abstractions ;
76using Microsoft . Extensions . Logging . Testing ;
87using NSubstitute ;
8+ using Shouldly ;
99
1010namespace Arius . Core . Tests . Commands ;
1111
@@ -63,17 +63,17 @@ public async Task CreateAsync_WhenNoRemoteStateExists_ShouldCreateNewStateFile()
6363 tempStateDirectory ) ;
6464
6565 // Assert
66- context . Should ( ) . NotBeNull ( ) ;
67- context . Request . Should ( ) . Be ( testCommand ) ;
68- context . BlobStorage . Should ( ) . Be ( mockBlobStorage ) ;
69- context . StateRepo . Should ( ) . NotBeNull ( ) ;
70- context . Hasher . Should ( ) . NotBeNull ( ) ;
71- context . FileSystem . Should ( ) . NotBeNull ( ) ;
66+ context . ShouldNotBeNull ( ) ;
67+ context . Request . ShouldBe ( testCommand ) ;
68+ context . BlobStorage . ShouldBe ( mockBlobStorage ) ;
69+ context . StateRepo . ShouldNotBeNull ( ) ;
70+ context . Hasher . ShouldNotBeNull ( ) ;
71+ context . FileSystem . ShouldNotBeNull ( ) ;
7272
7373 // Verify a new state file was created (with current timestamp format)
7474 var stateFiles = tempStateDirectory . GetFiles ( "*.db" ) ;
75- stateFiles . Should ( ) . HaveCount ( 1 ) ;
76- stateFiles [ 0 ] . Name . Should ( ) . MatchRegex ( @"\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.db" ) ;
75+ stateFiles . Length . ShouldBe ( 1 ) ;
76+ stateFiles [ 0 ] . Name . ShouldMatch ( @"\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.db" ) ;
7777
7878 // Verify no download was attempted since no remote state exists
7979 await mockBlobStorage . DidNotReceive ( ) . DownloadStateAsync ( Arg . Any < string > ( ) , Arg . Any < FileInfo > ( ) , Arg . Any < CancellationToken > ( ) ) ;
@@ -104,9 +104,9 @@ public async Task CreateAsync_WhenRemoteStateExistsButNotLocally_ShouldDownloadA
104104 tempStateDirectory ) ;
105105
106106 // Assert
107- context . Should ( ) . NotBeNull ( ) ;
108- context . Request . Should ( ) . Be ( testCommand ) ;
109- context . BlobStorage . Should ( ) . Be ( mockBlobStorage ) ;
107+ context . ShouldNotBeNull ( ) ;
108+ context . Request . ShouldBe ( testCommand ) ;
109+ context . BlobStorage . ShouldBe ( mockBlobStorage ) ;
110110
111111 // Verify the remote state was downloaded
112112 await mockBlobStorage . Received ( 1 ) . DownloadStateAsync (
@@ -116,15 +116,15 @@ await mockBlobStorage.Received(1).DownloadStateAsync(
116116
117117 // Verify a new state file was created (with current timestamp format)
118118 var stateFiles = tempStateDirectory . GetFiles ( "*.db" ) ;
119- stateFiles . Should ( ) . HaveCountGreaterThan ( 0 ) ;
119+ stateFiles . Length . ShouldBeGreaterThan ( 0 ) ;
120120
121121 // Should have the downloaded state file and the new version
122122 var downloadedStateFile = stateFiles . FirstOrDefault ( f => f . Name == $ "{ existingStateName } .db") ;
123- downloadedStateFile . Should ( ) . NotBeNull ( "the downloaded state file should exist" ) ;
123+ downloadedStateFile . ShouldNotBeNull ( "the downloaded state file should exist" ) ;
124124
125125 var newStateFile = stateFiles . FirstOrDefault ( f => f . Name != $ "{ existingStateName } .db") ;
126- newStateFile . Should ( ) . NotBeNull ( "a new state file should be created" ) ;
127- newStateFile . Name . Should ( ) . MatchRegex ( @"\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.db" ) ;
126+ newStateFile . ShouldNotBeNull ( "a new state file should be created" ) ;
127+ newStateFile . Name . ShouldMatch ( @"\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.db" ) ;
128128 }
129129
130130 [ Fact ]
@@ -147,24 +147,24 @@ public async Task CreateAsync_WhenRemoteStateExistsAndIsPresentLocally_ShouldNot
147147 tempStateDirectory ) ;
148148
149149 // Assert
150- context . Should ( ) . NotBeNull ( ) ;
151- context . Request . Should ( ) . Be ( testCommand ) ;
152- context . BlobStorage . Should ( ) . Be ( mockBlobStorage ) ;
150+ context . ShouldNotBeNull ( ) ;
151+ context . Request . ShouldBe ( testCommand ) ;
152+ context . BlobStorage . ShouldBe ( mockBlobStorage ) ;
153153
154154 // Verify no download was attempted since the file already exists locally
155155 await mockBlobStorage . DidNotReceive ( ) . DownloadStateAsync ( Arg . Any < string > ( ) , Arg . Any < FileInfo > ( ) , Arg . Any < CancellationToken > ( ) ) ;
156156
157157 // Verify a new state file was created (with current timestamp format)
158158 var stateFiles = tempStateDirectory . GetFiles ( "*.db" ) ;
159- stateFiles . Should ( ) . HaveCountGreaterThan ( 1 ) ;
159+ stateFiles . Length . ShouldBeGreaterThan ( 1 ) ;
160160
161161 // Should have the existing state file and the new version
162162 var existingFile = stateFiles . FirstOrDefault ( f => f . Name == $ "{ existingStateName } .db") ;
163- existingFile . Should ( ) . NotBeNull ( "the existing state file should still exist" ) ;
163+ existingFile . ShouldNotBeNull ( "the existing state file should still exist" ) ;
164164
165165 var newStateFile = stateFiles . FirstOrDefault ( f => f . Name != $ "{ existingStateName } .db") ;
166- newStateFile . Should ( ) . NotBeNull ( "a new state file should be created" ) ;
167- newStateFile . Name . Should ( ) . MatchRegex ( @"\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.db" ) ;
166+ newStateFile . ShouldNotBeNull ( "a new state file should be created" ) ;
167+ newStateFile . Name . ShouldMatch ( @"\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}\.db" ) ;
168168 }
169169
170170 public void Dispose ( )
0 commit comments