Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-dotnettools.csharp"
],
"postCreateCommand": "dotnet restore"
}
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-vscode-remote.remote-containers",
"ms-dotnettools.csharp"
]
}
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)StrongName.snk</AssemblyOriginatorKeyFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>9.0</LangVersion>
<PackageTags>testing</PackageTags>
<PackageProjectUrl>https://github.com/System-IO-Abstractions/System.IO.Abstractions</PackageProjectUrl>
Expand Down
7 changes: 7 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
2 changes: 0 additions & 2 deletions src/System.IO.Abstractions/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@

#if DEBUG
[assembly: InternalsVisibleTo("System.IO.Abstractions.Tests")]
[assembly: InternalsVisibleTo("System.IO.Abstractions.TestingHelpers.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
#else
[assembly: InternalsVisibleTo("System.IO.Abstractions.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001160c7a0f907c400c5392975b66d2f3752fb82625d5674d386b83896d4d4ae8d0ef8319ef391fbb3466de0058ad2f361b8f5cb8a32ecb4e908bece5c519387552cedd2ca0250e36b59c6d6dc3dc260ca73a7e27c3add4ae22d5abaa562225d7ba34d427e8f3f52928a46a674deb0208eca7d379aa22712355b91a55a5ce521d2")]
[assembly: InternalsVisibleTo("System.IO.Abstractions.TestingHelpers.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001001160c7a0f907c400c5392975b66d2f3752fb82625d5674d386b83896d4d4ae8d0ef8319ef391fbb3466de0058ad2f361b8f5cb8a32ecb4e908bece5c519387552cedd2ca0250e36b59c6d6dc3dc260ca73a7e27c3add4ae22d5abaa562225d7ba34d427e8f3f52928a46a674deb0208eca7d379aa22712355b91a55a5ce521d2")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2,PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
#endif

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ private static IEnumerable<Action<IDirectory>> GetFileSystemActionsForArgumentNu
yield return ds => ds.Delete(null, true);
yield return ds => ds.CreateDirectory(null);
if (MockUnixSupport.IsWindowsPlatform())
{
#pragma warning disable CA1416
yield return ds => ds.CreateDirectory(null, new DirectorySecurity());
#pragma warning restore CA1416
}
yield return ds => ds.SetCreationTime(null, DateTime.Now);
yield return ds => ds.SetCreationTimeUtc(null, DateTime.Now);
yield return ds => ds.SetLastAccessTime(null, DateTime.Now);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.AccessControl;
using System.Runtime.Versioning;

namespace System.IO.Abstractions.TestingHelpers.Tests
{
using XFS = MockUnixSupport;
[TestFixture]
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
[SupportedOSPlatform("windows")]
public class MockDirectoryGetAccessControlTests
{
[TestCase(" ")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using NUnit.Framework;
using System.Collections.Generic;
using System.Runtime.Versioning;
using System.Security.AccessControl;
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;

namespace System.IO.Abstractions.TestingHelpers.Tests
{
[TestFixture]
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
[SupportedOSPlatform("windows")]
public class MockDirectoryInfoAccessControlTests
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.IO.Abstractions.TestingHelpers.Tests
{
using System.Runtime.Versioning;
using Security.AccessControl;
using XFS = MockUnixSupport;

[TestFixture]
[SupportedOSPlatform("windows")]
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
public class MockDirectorySetAccessControlTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.AccessControl;
using System.Runtime.Versioning;

namespace System.IO.Abstractions.TestingHelpers.Tests
{
using XFS = MockUnixSupport;
[TestFixture]
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
[SupportedOSPlatform("windows")]
public class MockFileGetAccessControlTests
{
[TestCase(" ")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using NUnit.Framework;
using System.Collections.Generic;
using System.Runtime.Versioning;
using System.Security.AccessControl;
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;

namespace System.IO.Abstractions.TestingHelpers.Tests
{
[TestFixture]
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
[SupportedOSPlatform("windows")]
public class MockFileInfoAccessControlTests
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using NUnit.Framework;
using System.Collections.Generic;
using System.Runtime.Versioning;
using System.Security.AccessControl;
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;

namespace System.IO.Abstractions.TestingHelpers.Tests
{
[TestFixture]
[WindowsOnly(WindowsSpecifics.AccessControlLists)]
[SupportedOSPlatform("windows")]
public class MockFileSetAccessControlTests
{
[TestCase(" ")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ public void SerializationBytes()
//Act
var memoryStream = new MemoryStream();
var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();

#pragma warning disable SYSLIB0011
serializer.Serialize(memoryStream, fileSystem);
memoryStream.Flush();
memoryStream.Position = 0;
fileSystem = (MockFileSystem)serializer.Deserialize(memoryStream);
#pragma warning restore SYSLIB0011
memoryStream.Dispose();

// Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ public void MockFileSystem_ByDefault_IsSerializable()
var memoryStream = new MemoryStream();

var serializer = new Runtime.Serialization.Formatters.Binary.BinaryFormatter();

#pragma warning disable SYSLIB0011
serializer.Serialize(memoryStream, fileSystem);
#pragma warning restore SYSLIB0011

Assert.That(memoryStream.Length > 0, "Length didn't increase after serialization task.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ public void Serializable_works()
//Act
IFormatter formatter = new BinaryFormatter();
Stream stream = new MemoryStream();

#pragma warning disable SYSLIB0011
formatter.Serialize(stream, data);
#pragma warning restore SYSLIB0011

//Assert
Assert.Pass();
Expand All @@ -560,11 +563,13 @@ public void Serializable_can_deserialize()

IFormatter formatter = new BinaryFormatter();
Stream stream = new MemoryStream();
#pragma warning disable SYSLIB0011
formatter.Serialize(stream, data);

stream.Seek(0, SeekOrigin.Begin);

MockFileData deserialized = (MockFileData)formatter.Deserialize(stream);
#pragma warning restore SYSLIB0011

//Assert
Assert.That(deserialized.TextContents, Is.EqualTo(textContentStr));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ public static IEnumerable<KeyValuePair<Encoding, byte[]>> GetEncodingsWithExpect
101, 0, 0, 0, 33, 0, 0, 0, 32, 0, 0, 0, 68, 0, 0, 0, 122, 0,
0, 0, 105, 0, 0, 0, 25, 1, 0, 0, 107, 0, 0, 0, 105, 0, 0, 0, 46, 0, 0, 0 } },

#pragma warning disable SYSLIB0001
// UTF-7 does not need a BOM
{ Encoding.UTF7, new byte [] {72, 101, 108, 108, 111, 32, 116,
104, 101, 114, 101, 43, 65, 67, 69, 45, 32, 68, 122, 105,
43, 65, 82, 107, 45, 107, 105, 46 } },
#pragma warning restore SYSLIB0001

// The default encoding does not need a BOM
{ utf8WithoutBom, new byte [] { 72, 101, 108, 108, 111, 32, 116,
Expand Down