Skip to content

Commit 9e788bc

Browse files
authored
Merge branch 'master' into master
2 parents 95ead3a + 0ae3ed8 commit 9e788bc

8 files changed

Lines changed: 32 additions & 18 deletions

File tree

System.IO.Abstractions/System.IO.Abstractions.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<Description>A set of abstractions to help make file system interactions testable.</Description>
99
<Copyright>Copyright © Tatham Oddie 2010</Copyright>
1010
<AssemblyOriginatorKeyFile>../StrongName.snk</AssemblyOriginatorKeyFile>
11-
<PackageLicenseUrl>https://github.com/tathamoddie/System.IO.Abstractions/blob/master/License.txt</PackageLicenseUrl>
12-
<PackageProjectUrl>https://github.com/tathamoddie/System.IO.Abstractions</PackageProjectUrl>
11+
<PackageLicenseUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions/blob/master/License.txt</PackageLicenseUrl>
12+
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>
1313
<PackageTags>testing</PackageTags>
1414
</PropertyGroup>
1515

System.IO.Abstractions/System.IO.Abstractions.nuspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<metadata>
44
<id>System.IO.Abstractions</id>
55
<version>$version$</version>
6-
<authors>Tatham Oddie</authors>
7-
<owners>Tatham Oddie</owners>
8-
<licenseUrl>https://github.com/tathamoddie/System.IO.Abstractions/blob/master/License.txt</licenseUrl>
9-
<projectUrl>https://github.com/tathamoddie/System.IO.Abstractions</projectUrl>
6+
<authors>Tatham Oddie &amp; friends</authors>
7+
<owners>Tatham Oddie &amp; friends</owners>
8+
<licenseUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions/blob/master/License.txt</licenseUrl>
9+
<projectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1111
<description>Just like System.Web.Abstractions, but for System.IO. Yay for testable IO access! Be sure to check out the System.IO.Abstractions.TestingHelpers package too.</description>
1212
<tags>testing</tags>

TestingHelpers/MockDirectory.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public MockDirectory(IMockFileDataAccessor mockFileDataAccessor, FileBase fileBa
3232

3333
public override DirectoryInfoBase CreateDirectory(string path)
3434
{
35-
return CreateDirectoryInternal(path, new DirectorySecurity());
35+
return CreateDirectoryInternal(path, null);
3636
}
3737

3838
#if NET40
@@ -61,7 +61,11 @@ private DirectoryInfoBase CreateDirectoryInternal(string path, DirectorySecurity
6161
}
6262

6363
var created = new MockDirectoryInfo(mockFileDataAccessor, path);
64-
created.SetAccessControl(directorySecurity);
64+
if (directorySecurity != null)
65+
{
66+
created.SetAccessControl(directorySecurity);
67+
}
68+
6569
return created;
6670
}
6771

TestingHelpers/MockDirectoryData.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@ namespace System.IO.Abstractions.TestingHelpers
66
public class MockDirectoryData : MockFileData
77
{
88
[NonSerialized]
9-
private DirectorySecurity accessControl = new DirectorySecurity();
9+
private DirectorySecurity accessControl;
1010

1111
public override bool IsDirectory { get { return true; } }
1212

1313
public MockDirectoryData() : base(string.Empty)
1414
{
1515
Attributes = FileAttributes.Directory;
1616
}
17-
17+
1818
public new DirectorySecurity AccessControl
1919
{
20-
get { return accessControl; }
20+
get
21+
{
22+
// DirectorySecurity's constructor will throw PlatformNotSupportedException on non-Windows platform, so we initialize it in lazy way.
23+
// This let's us use this class as long as we don't use AccessControl property.
24+
return accessControl ?? (accessControl = new DirectorySecurity());
25+
}
2126
set { accessControl = value; }
2227
}
2328
}

TestingHelpers/MockFileData.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class MockFileData
6060
/// The access control of the <see cref="MockFileData"/>.
6161
/// </summary>
6262
[NonSerialized]
63-
private FileSecurity accessControl = new FileSecurity();
63+
private FileSecurity accessControl;
6464

6565
/// <summary>
6666
/// Gets a value indicating whether the <see cref="MockFileData"/> is a directory or not.
@@ -181,7 +181,12 @@ public FileAttributes Attributes
181181
/// </summary>
182182
public FileSecurity AccessControl
183183
{
184-
get { return accessControl; }
184+
get
185+
{
186+
// FileSecurity's constructor will throw PlatformNotSupportedException on non-Windows platform, so we initialize it in lazy way.
187+
// This let's us use this class as long as we don't use AccessControl property.
188+
return accessControl ?? (accessControl = new FileSecurity());
189+
}
185190
set { accessControl = value; }
186191
}
187192
}

TestingHelpers/MockFileSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public void AddDirectory(string path)
173173

174174
/*
175175
* Although CreateDirectory(@"\\server\share\") is not going to work in real code, we allow it here for the purposes of setting up test doubles.
176-
* See PR https://github.com/tathamoddie/System.IO.Abstractions/pull/90 for conversation
176+
* See PR https://github.com/System-IO-Abstractions/System.IO.Abstractions/pull/90 for conversation
177177
*/
178178
}
179179

TestingHelpers/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<value>Illegal characters in path.</value>
128128
</data>
129129
<data name="NOT_IMPLEMENTED_EXCEPTION" xml:space="preserve">
130-
<value>This test helper hasn't been implemented yet. They are implemented on an as-needed basis. As it seems like you need it, now would be a great time to send us a pull request over at https://github.com/tathamoddie/System.IO.Abstractions. You know, because it's open source and all.</value>
130+
<value>This test helper hasn't been implemented yet. They are implemented on an as-needed basis. As it seems like you need it, now would be a great time to send us a pull request over at https://github.com/System-IO-Abstractions/System.IO.Abstractions. You know, because it's open source and all.</value>
131131
</data>
132132
<data name="THE_PATH_IS_NOT_OF_A_LEGAL_FORM" xml:space="preserve">
133133
<value>The path is not of a legal form.</value>

TestingHelpers/TestingHelpers.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<Company />
88
<Product>System.IO.Abstractions</Product>
99
<Copyright>Copyright © Tatham Oddie 2010</Copyright>
10-
<Authors>Tatham Oddie</Authors>
10+
<Authors>Tatham Oddie &amp; friends</Authors>
1111
<RootNamespace>System.IO.Abstractions.TestingHelpers</RootNamespace>
1212
<AssemblyOriginatorKeyFile>../StrongName.snk</AssemblyOriginatorKeyFile>
13-
<PackageLicenseUrl>https://github.com/tathamoddie/System.IO.Abstractions/blob/master/License.txt</PackageLicenseUrl>
14-
<PackageProjectUrl>https://github.com/tathamoddie/System.IO.Abstractions</PackageProjectUrl>
13+
<PackageLicenseUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions/blob/master/License.txt</PackageLicenseUrl>
14+
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>
1515
</PropertyGroup>
1616

1717
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

0 commit comments

Comments
 (0)