Explicitly creating all directories in MockFileSystem #28

Merged
merged 12 commits into from Mar 24, 2013

Conversation

Projects
None yet
2 participants
Contributor

martindevans commented Mar 22, 2013

The major change here is that the data passed into the MockFileSystem creates all directories implied by the data. So:

{
{ @"A:\1\2\3\foo.txt", new MockFileData("Hello") }
}

will now create entries for the directories:

  • "A:\1"
  • "A:\1\2"
  • "A:\1\2\3"

as well as the file:

  • "A:\1\2\3\foo.txt".

This helped me implement MockDirectoryInfo.GetDirectories.

I also implemented a few methods I needed on MockDirectoryInfo:

  • GetDirectories (obviously)
  • Create
  • Delete
  • GetAccessControl
  • MoveTo
  • SetAccessControl
  • Parent

Finally, I added attributes to MockFileData, and then exposed them in MockFileData & MockDirectoryInfo

Andreas Eriksson and others added some commits Mar 4, 2013

Andreas Eriksson Implemented delete d995c61
Andreas Eriksson implemented Create 1ba9c5d
Andreas Eriksson Adding File.Delete and File.Create test-helpers f9d4b78
@martindevans martindevans Implemented GetParent in MockDirectory.cs
Implemented various methods I needed in MockDirectoryInfo.cs
 - Create
 - Delete
 - GetAccessControl
 - MoveTo
 - SetAccessControl
 - Parent

Signed-off-by: Martin Evans <martindevans@gmail.com>
e2b8504
@martindevans martindevans Modified MockFileSystem to explicitly create all files *and* director…
…ies in the set handed in to the constructor

Implemented MockFileInfo Delete() and Attributes property
Added attributes to MockFileData.cs
Implemented property to retrieve directory attributes in MockDirectoryInfo.cs

Signed-off-by: Martin Evans <martindevans@gmail.com>
4ed8170
@martindevans martindevans Merge branch 'master' of git://github.com/ncvib/System.IO.Abstractions
Conflicts:
	TestHelpers.Tests/MockFileTests.cs
	TestingHelpers/MockFile.cs

Signed-off-by: Martin Evans <martindevans@gmail.com>
55c4d2d
@martindevans martindevans Fixed the tests in MockFileTests.cs being merged incorrectly
Signed-off-by: Martin Evans <martindevans@gmail.com>
f35b1bf
@martindevans martindevans Implemented CreateSubdirectory in MockDirectoryInfo.cs
Delete the exception in MockDirectoryInfo.cs Refresh()

Signed-off-by: Martin Evans <martindevans@gmail.com>
bb1dd1f
@martindevans martindevans Implemented GetFiles in MockDirectoryInfo.cs
Signed-off-by: Martin Evans <martindevans@gmail.com>
d462a49
@martindevans martindevans Implemented CopyTo in MockFileInfo.cs
implemented GetDirectories in MockDirectoryInfo.cs

Signed-off-by: Martin Evans <martindevans@gmail.com>
6a69941
@martindevans martindevans Modified the MockDirectory_Delete tests to correctly specify recursive
Modified CreateDirectory to explicitly create all directories in the chain up to the one being created
Modified getFilesInternal to correctly handle directories and files
Modified MockFileSystem to explicitly create all directories in the test data

Signed-off-by: Martin Evans <martindevans@gmail.com>
1207720
@martindevans martindevans Made sure MockDirectoryInfo.cs always stores its path with a trailing \
Made MockDirectory.cs CreateDirectory not throw an exception if trying to create a folder which already exists

Signed-off-by: Martin Evans <martindevans@gmail.com>
dff19c0

@tathamoddie tathamoddie added a commit that referenced this pull request Mar 24, 2013

@tathamoddie tathamoddie Merge pull request #28 from martindevans/master
Explicitly creating all directories in MockFileSystem
3ed19bd

@tathamoddie tathamoddie merged commit 3ed19bd into tathamoddie:master Mar 24, 2013

Owner

tathamoddie commented Mar 24, 2013

Thanks @whyer and @martindevans!

This has been published to NuGet as of 1.4.0.45.

martindevans referenced this pull request Mar 24, 2013

Closed

Support MockFile.Delete #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment