@@ -23,6 +23,7 @@ namespace chocolatey.tests.integration.infrastructure.filesystem
23
23
using chocolatey . infrastructure . platforms ;
24
24
using NUnit . Framework ;
25
25
using FluentAssertions ;
26
+ using FluentAssertions . Extensions ;
26
27
27
28
public class DotNetFileSystemSpecs
28
29
{
@@ -85,13 +86,13 @@ public void GetExecutablePath_should_return_same_value_when_executable_is_not_fo
85
86
[ Fact ]
86
87
public void GetExecutablePath_should_return_empty_string_when_value_is_null ( )
87
88
{
88
- FileSystem . GetExecutablePath ( null ) . Should ( ) . Be ( string . Empty ) ;
89
+ FileSystem . GetExecutablePath ( null ) . Should ( ) . BeEmpty ( ) ;
89
90
}
90
91
91
92
[ Fact ]
92
93
public void GetExecutablePath_should_return_empty_string_when_value_is_empty_string ( )
93
94
{
94
- FileSystem . GetExecutablePath ( string . Empty ) . Should ( ) . Be ( string . Empty ) ;
95
+ FileSystem . GetExecutablePath ( string . Empty ) . Should ( ) . BeEmpty ( ) ;
95
96
}
96
97
}
97
98
@@ -130,8 +131,7 @@ public void GetFiles_should_return_files_that_meet_the_pattern()
130
131
var actual = FileSystem . GetFiles ( ContextPath , "chocolateyInstall.ps1" , SearchOption . AllDirectories ) . ToList ( ) ;
131
132
FileSystem . DeleteFile ( filePath ) ;
132
133
133
- actual . Should ( ) . NotBeEmpty ( ) ;
134
- actual . Count ( ) . Should ( ) . Be ( 1 ) ;
134
+ actual . Should ( ) . ContainSingle ( ) ;
135
135
}
136
136
137
137
[ Fact ]
@@ -145,8 +145,7 @@ public void GetFiles_should_return_files_that_meet_the_pattern_regardless_of_cas
145
145
var actual = FileSystem . GetFiles ( ContextPath , "chocolateyinstall.ps1" , SearchOption . AllDirectories ) . ToList ( ) ;
146
146
FileSystem . DeleteFile ( filePath ) ;
147
147
148
- actual . Should ( ) . NotBeEmpty ( ) ;
149
- actual . Count ( ) . Should ( ) . Be ( 1 ) ;
148
+ actual . Should ( ) . ContainSingle ( ) ;
150
149
}
151
150
152
151
[ Fact ]
@@ -205,7 +204,7 @@ public override void Because()
205
204
[ Fact ]
206
205
public void Visible_file_should_now_be_hidden ( )
207
206
{
208
- ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes & FileAttributes . Hidden ) . Should ( ) . Be ( FileAttributes . Hidden ) ;
207
+ ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes ) . Should ( ) . HaveFlag ( FileAttributes . Hidden ) ;
209
208
}
210
209
211
210
public override void AfterObservations ( )
@@ -232,7 +231,7 @@ public override void Because()
232
231
[ Fact ]
233
232
public void Readonly_file_should_no_longer_be_readonly ( )
234
233
{
235
- ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes & FileAttributes . ReadOnly ) . Should ( ) . NotBe ( FileAttributes . ReadOnly ) ;
234
+ ( ( FileAttributes ) FileSystem . GetFileInfoFor ( SourceFile ) . Attributes ) . Should ( ) . NotHaveFlag ( FileAttributes . ReadOnly ) ;
236
235
}
237
236
}
238
237
@@ -351,7 +350,7 @@ public override void Because()
351
350
[ Fact ]
352
351
public void Should_have_correct_modified_date ( )
353
352
{
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 ( ) ) ;
355
354
}
356
355
}
357
356
}
0 commit comments