@@ -23,6 +23,7 @@ namespace chocolatey.tests.integration.infrastructure.filesystem
2323 using chocolatey . infrastructure . platforms ;
2424 using NUnit . Framework ;
2525 using FluentAssertions ;
26+ using FluentAssertions . Extensions ;
2627
2728 public class DotNetFileSystemSpecs
2829 {
@@ -85,13 +86,13 @@ public void GetExecutablePath_should_return_same_value_when_executable_is_not_fo
8586 [ Fact ]
8687 public void GetExecutablePath_should_return_empty_string_when_value_is_null ( )
8788 {
88- FileSystem . GetExecutablePath ( null ) . Should ( ) . Be ( string . Empty ) ;
89+ FileSystem . GetExecutablePath ( null ) . Should ( ) . BeEmpty ( ) ;
8990 }
9091
9192 [ Fact ]
9293 public void GetExecutablePath_should_return_empty_string_when_value_is_empty_string ( )
9394 {
94- FileSystem . GetExecutablePath ( string . Empty ) . Should ( ) . Be ( string . Empty ) ;
95+ FileSystem . GetExecutablePath ( string . Empty ) . Should ( ) . BeEmpty ( ) ;
9596 }
9697 }
9798
@@ -130,8 +131,7 @@ public void GetFiles_should_return_files_that_meet_the_pattern()
130131 var actual = FileSystem . GetFiles ( ContextPath , "chocolateyInstall.ps1" , SearchOption . AllDirectories ) . ToList ( ) ;
131132 FileSystem . DeleteFile ( filePath ) ;
132133
133- actual . Should ( ) . NotBeEmpty ( ) ;
134- actual . Count ( ) . Should ( ) . Be ( 1 ) ;
134+ actual . Should ( ) . ContainSingle ( ) ;
135135 }
136136
137137 [ Fact ]
@@ -145,8 +145,7 @@ public void GetFiles_should_return_files_that_meet_the_pattern_regardless_of_cas
145145 var actual = FileSystem . GetFiles ( ContextPath , "chocolateyinstall.ps1" , SearchOption . AllDirectories ) . ToList ( ) ;
146146 FileSystem . DeleteFile ( filePath ) ;
147147
148- actual . Should ( ) . NotBeEmpty ( ) ;
149- actual . Count ( ) . Should ( ) . Be ( 1 ) ;
148+ actual . Should ( ) . ContainSingle ( ) ;
150149 }
151150
152151 [ Fact ]
@@ -205,7 +204,7 @@ public override void Because()
205204 [ Fact ]
206205 public void Visible_file_should_now_be_hidden ( )
207206 {
208- ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes & FileAttributes . Hidden ) . Should ( ) . Be ( FileAttributes . Hidden ) ;
207+ ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes ) . Should ( ) . HaveFlag ( FileAttributes . Hidden ) ;
209208 }
210209
211210 public override void AfterObservations ( )
@@ -232,7 +231,7 @@ public override void Because()
232231 [ Fact ]
233232 public void Readonly_file_should_no_longer_be_readonly ( )
234233 {
235- ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes & FileAttributes . ReadOnly ) . Should ( ) . NotBe ( FileAttributes . ReadOnly ) ;
234+ ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes ) . Should ( ) . NotHaveFlag ( FileAttributes . ReadOnly ) ;
236235 }
237236 }
238237
@@ -351,7 +350,7 @@ public override void Because()
351350 [ Fact ]
352351 public void Should_have_correct_modified_date ( )
353352 {
354- FileSystem . GetFileModifiedDate ( TheTestFile ) . ToShortDateString ( ) . Should ( ) . Be ( DateTime . Now . AddDays ( - 1 ) . ToShortDateString ( ) ) ;
353+ FileSystem . GetFileModifiedDate ( TheTestFile ) . Should ( ) . BeCloseTo ( 1 . Days ( ) . Before ( DateTime . Now ) , 5 . Seconds ( ) ) ;
355354 }
356355 }
357356 }
0 commit comments