File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
src/TestableIO.System.IO.Abstractions.TestingHelpers
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,7 @@ public void AddEmptyFile(string path)
225225 public void AddEmptyFile ( IFileInfo path )
226226 {
227227 AddEmptyFile ( path . FullName ) ;
228+ path . Refresh ( ) ;
228229 }
229230
230231 /// <summary>
@@ -234,6 +235,7 @@ public void AddEmptyFile(IFileInfo path)
234235 public void AddDirectory ( IDirectoryInfo path )
235236 {
236237 AddDirectory ( path . FullName ) ;
238+ path . Refresh ( ) ;
237239 }
238240
239241 /// <summary>
@@ -244,6 +246,7 @@ public void AddDirectory(IDirectoryInfo path)
244246 public void AddFile ( IFileInfo path , MockFileData data )
245247 {
246248 AddFile ( path . FullName , data ) ;
249+ path . Refresh ( ) ;
247250 }
248251
249252 /// <summary>
Original file line number Diff line number Diff line change @@ -130,6 +130,39 @@ public void MockFileSystem_AddEmptyFile_ShouldBeEmpty()
130130 Assert . That ( fileSystem . GetFile ( path ) . TextContents , Is . EqualTo ( "" ) ) ;
131131 }
132132
133+ [ Test ]
134+ public void MockFileSystem_AddEmptyFile_ShouldExist ( )
135+ {
136+ var fileSystem = new MockFileSystem ( ) ;
137+ var path = fileSystem . FileInfo . New ( XFS . Path ( @"c:\some\file.txt" ) ) ;
138+
139+ fileSystem . AddEmptyFile ( path ) ;
140+
141+ Assert . That ( path . Exists , Is . True ) ;
142+ }
143+
144+ [ Test ]
145+ public void MockFileSystem_AddFile_ShouldExist ( )
146+ {
147+ var fileSystem = new MockFileSystem ( ) ;
148+ var path = fileSystem . FileInfo . New ( XFS . Path ( @"c:\some\file.txt" ) ) ;
149+
150+ fileSystem . AddFile ( path , new MockFileData ( "stuff" ) ) ;
151+
152+ Assert . That ( path . Exists , Is . True ) ;
153+ }
154+
155+ [ Test ]
156+ public void MockFileSystem_AddDirectory_ShouldExist ( )
157+ {
158+ var fileSystem = new MockFileSystem ( ) ;
159+ var path = fileSystem . DirectoryInfo . New ( XFS . Path ( @"c:\thedir" ) ) ;
160+
161+ fileSystem . AddDirectory ( path ) ;
162+
163+ Assert . That ( path . Exists , Is . True ) ;
164+ }
165+
133166 [ Test ]
134167 public void MockFileSystem_ByDefault_IsSerializable ( )
135168 {
You can’t perform that action at this time.
0 commit comments