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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Is_Serializable()
}
#endif

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[Test]
public void Mock_File_Succeeds()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using NUnit.Framework;
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
#endif

Expand Down Expand Up @@ -123,7 +123,7 @@ public void MockFile_AppendAllLines_ShouldThrowArgumentNullExceptionIfEncodingIs
Assert.That(exception.ParamName, Is.EqualTo("encoding"));
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[Test]
public async Task MockFile_AppendAllLinesAsync_ShouldPersistNewLinesToExistingFile()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace System.IO.Abstractions.TestingHelpers.Tests

using XFS = MockUnixSupport;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
#endif

Expand Down Expand Up @@ -158,7 +158,7 @@ public void MockFile_AppendAllText_ShouldWorkWithRelativePath()
Assert.That(fileSystem.File.Exists(file));
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[Test]
public async Task MockFile_AppendAllTextAsync_ShouldPersistNewText()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using NUnit.Framework;
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
#endif

Expand Down Expand Up @@ -64,7 +64,7 @@ public void MockFile_ReadAllBytes_ShouldTolerateAltDirectorySeparatorInPath()

Assert.AreEqual(data, fileSystem.File.ReadAllBytes(altPath));
}
#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[Test]
public async Task MockFile_ReadAllBytesAsync_ShouldReturnOriginalByteData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace System.IO.Abstractions.TestingHelpers.Tests

using XFS = MockUnixSupport;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
#endif

Expand Down Expand Up @@ -71,7 +71,7 @@ public void MockFile_ReadAllLines_NotExistingFile_ThrowsCorrectFileNotFoundExcep
Assert.That(exception.Message, Is.EqualTo("Could not find file '" + absentFileNameFullPath + "'."));
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[Test]
public async Task MockFile_ReadAllLinesAsync_ShouldReturnOriginalTextData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using NUnit.Framework;
using XFS = System.IO.Abstractions.TestingHelpers.MockUnixSupport;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
#endif

Expand Down Expand Up @@ -85,7 +85,7 @@ public void MockFile_WriteAllBytes_ShouldThrowAnArgumentNullExceptionIfBytesAreN
Assert.That(exception.ParamName, Is.EqualTo("bytes"));
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[Test]
public void MockFile_WriteAllBytesAsync_ShouldThrowDirectoryNotFoundExceptionIfPathDoesNotExists()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public static IEnumerable ForContentsIsNull
}
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public static IEnumerable ForDifferentEncodingAsync
{
get
Expand Down Expand Up @@ -485,7 +485,7 @@ public void MockFile_WriteAllLinesGeneric_ShouldThrowAnArgumentNullExceptionIfCo
Assert.That(exception.ParamName, Is.EqualTo("contents"));
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[TestCaseSource(typeof(TestDataForWriteAllLines), "ForDifferentEncodingAsync")]
public void MockFile_WriteAllLinesAsyncGeneric_ShouldWriteTheCorrectContent(IMockFileDataAccessor fileSystem, Action action, string expectedContent)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

using XFS = MockUnixSupport;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
#endif

Expand Down Expand Up @@ -227,7 +227,7 @@ public void MockFile_WriteAllTextMultipleLines_ShouldWriteTextFileToMemoryFileSy
fileSystem.GetFile(path).TextContents);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
[Test]
public async Task MockFile_WriteAllTextAsync_ShouldWriteTextFileToMemoryFileSystem()
{
Expand Down
16 changes: 8 additions & 8 deletions System.IO.Abstractions.TestingHelpers/MockFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override void AppendAllLines(string path, IEnumerable<string> contents, E
AppendAllText(path, concatContents, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task AppendAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken = default(CancellationToken))
{
AppendAllLines(path, contents);
Expand Down Expand Up @@ -82,7 +82,7 @@ public override void AppendAllText(string path, string contents, Encoding encodi
}
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task AppendAllTextAsync(string path, string contents, CancellationToken cancellationToken = default(CancellationToken))
{
AppendAllText(path, contents);
Expand Down Expand Up @@ -491,7 +491,7 @@ public override byte[] ReadAllBytes(string path)
return mockFileDataAccessor.GetFile(path).Contents;
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task<byte[]> ReadAllBytesAsync(string path, CancellationToken cancellationToken = default(CancellationToken))
{
return Task.FromResult(ReadAllBytes(path));
Expand Down Expand Up @@ -534,7 +534,7 @@ public override string[] ReadAllLines(string path, Encoding encoding)
.SplitLines();
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task<string[]> ReadAllLinesAsync(string path, CancellationToken cancellationToken = default(CancellationToken))
{
return Task.FromResult(ReadAllLines(path));
Expand Down Expand Up @@ -570,7 +570,7 @@ public override string ReadAllText(string path, Encoding encoding)
return ReadAllTextInternal(path, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task<string> ReadAllTextAsync(string path, CancellationToken cancellationToken)
{
return Task.FromResult(ReadAllText(path));
Expand Down Expand Up @@ -752,7 +752,7 @@ public override void WriteAllBytes(string path, byte[] bytes)
mockFileDataAccessor.AddFile(path, new MockFileData(bytes));
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken)
{
WriteAllBytes(path, bytes);
Expand Down Expand Up @@ -947,7 +947,7 @@ public override void WriteAllLines(string path, string[] contents, Encoding enco
WriteAllLines(path, new List<string>(contents), encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task WriteAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken)
{
WriteAllLines(path, contents);
Expand Down Expand Up @@ -1056,7 +1056,7 @@ public override void WriteAllText(string path, string contents, Encoding encodin
mockFileDataAccessor.AddFile(path, data);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task WriteAllTextAsync(string path, string contents, CancellationToken cancellationToken)
{
WriteAllText(path, contents);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.4;netstandard2.0;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netstandard1.4;netstandard2.0;netstandard2.1;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOsUnixLike())">$(TargetFrameworks);net40</TargetFrameworks>
<PackageId>System.IO.Abstractions.TestingHelpers</PackageId>
<Description>A set of pre-built mocks to help when testing file system interactions.</Description>
Expand All @@ -26,7 +26,7 @@
<ProjectReference Include="..\System.IO.Abstractions\System.IO.Abstractions.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0'">
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'netcoreapp2.0'">
<PackageReference Include="System.IO.FileSystem.AccessControl">
<Version>4.6.0</Version>
</PackageReference>
Expand Down
18 changes: 9 additions & 9 deletions System.IO.Abstractions/FileBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Security.AccessControl;
using System.Text;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
using System.Threading;
#endif
Expand Down Expand Up @@ -32,7 +32,7 @@ internal FileBase() { }
/// <inheritdoc cref="File.AppendAllLines(string,IEnumerable{string},Encoding)"/>
public abstract void AppendAllLines(string path, IEnumerable<string> contents, Encoding encoding);

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
/// <inheritdoc cref="File.AppendAllLinesAsync(string,IEnumerable{string},CancellationToken)"/>
public abstract Task AppendAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken);

Expand All @@ -46,7 +46,7 @@ internal FileBase() { }
/// <inheritdoc cref="File.AppendAllText(string,string,Encoding)"/>
public abstract void AppendAllText(string path, string contents, Encoding encoding);

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
/// <inheritdoc cref="File.AppendAllTextAsync(string,string,CancellationToken)"/>
public abstract Task AppendAllTextAsync(String path, String contents, CancellationToken cancellationToken);

Expand Down Expand Up @@ -308,7 +308,7 @@ internal FileBase() { }
/// <inheritdoc cref="File.ReadAllBytes"/>
public abstract byte[] ReadAllBytes(string path);

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
/// <inheritdoc cref="File.ReadAllBytesAsync"/>
public abstract Task<byte[]> ReadAllBytesAsync(string path, CancellationToken cancellationToken);
#endif
Expand All @@ -319,7 +319,7 @@ internal FileBase() { }
/// <inheritdoc cref="File.ReadAllLines(string,Encoding)"/>
public abstract string[] ReadAllLines(string path, Encoding encoding);

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
/// <inheritdoc cref="File.ReadAllLinesAsync(string,CancellationToken)"/>
public abstract Task<string[]> ReadAllLinesAsync(string path, CancellationToken cancellationToken);

Expand All @@ -333,7 +333,7 @@ internal FileBase() { }
/// <inheritdoc cref="File.ReadAllText(string,Encoding)"/>
public abstract string ReadAllText(string path, Encoding encoding);

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
///<inheritdoc cref="File.ReadAllTextAsync(string,CancellationToken)"/>
public abstract Task<string> ReadAllTextAsync(string path, CancellationToken cancellationToken);

Expand Down Expand Up @@ -446,7 +446,7 @@ internal FileBase() { }
/// </para>
/// </remarks>

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
/// <inheritdoc cref="File.WriteAllBytesAsync"/>
public abstract Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken);
#endif
Expand Down Expand Up @@ -610,7 +610,7 @@ internal FileBase() { }
/// </para>
/// </remarks>

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
/// <inheritdoc cref="File.WriteAllLinesAsync(string,IEnumerable{string},CancellationToken)"/>
public abstract Task WriteAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken);

Expand Down Expand Up @@ -658,7 +658,7 @@ internal FileBase() { }
/// </remarks>
public abstract void WriteAllText(string path, string contents, Encoding encoding);

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
/// <inheritdoc cref="File.WriteAllTextAsync(string,string,CancellationToken)"/>
public abstract Task WriteAllTextAsync(string path, string contents, CancellationToken cancellationToken);

Expand Down
18 changes: 9 additions & 9 deletions System.IO.Abstractions/FileWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Security.AccessControl;
using System.Text;

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
using System.Threading.Tasks;
using System.Threading;
#endif
Expand All @@ -27,7 +27,7 @@ public override void AppendAllLines(string path, IEnumerable<string> contents, E
File.AppendAllLines(path, contents, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task AppendAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken)
{
return File.AppendAllLinesAsync(path, contents, cancellationToken);
Expand All @@ -49,7 +49,7 @@ public override void AppendAllText(string path, string contents, Encoding encodi
File.AppendAllText(path, contents, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task AppendAllTextAsync(string path, string contents, CancellationToken cancellationToken)
{
return File.AppendAllTextAsync(path, contents, cancellationToken);
Expand Down Expand Up @@ -224,7 +224,7 @@ public override byte[] ReadAllBytes(string path)
return File.ReadAllBytes(path);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task<byte[]> ReadAllBytesAsync(string path, CancellationToken cancellationToken)
{
return File.ReadAllBytesAsync(path, cancellationToken);
Expand All @@ -241,7 +241,7 @@ public override string[] ReadAllLines(string path, Encoding encoding)
return File.ReadAllLines(path, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task<string[]> ReadAllLinesAsync(string path, CancellationToken cancellationToken)
{
return File.ReadAllLinesAsync(path, cancellationToken);
Expand All @@ -263,7 +263,7 @@ public override string ReadAllText(string path, Encoding encoding)
return File.ReadAllText(path, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task<string> ReadAllTextAsync(string path, CancellationToken cancellationToken)
{
return File.ReadAllTextAsync(path, cancellationToken);
Expand Down Expand Up @@ -371,7 +371,7 @@ public override void WriteAllBytes(string path, byte[] bytes)
File.WriteAllBytes(path, bytes);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken)
{
return File.WriteAllBytesAsync(path, bytes, cancellationToken);
Expand Down Expand Up @@ -545,7 +545,7 @@ public override void WriteAllLines(string path, string[] contents, Encoding enco
File.WriteAllLines(path, contents, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task WriteAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken)
{
return File.WriteAllLinesAsync(path, contents, cancellationToken);
Expand Down Expand Up @@ -639,7 +639,7 @@ public override void WriteAllText(string path, string contents, Encoding encodin
File.WriteAllText(path, contents, encoding);
}

#if NETCOREAPP2_0
#if NETCOREAPP2_0 || NETSTANDARD2_1
public override Task WriteAllTextAsync(string path, string contents, CancellationToken cancellationToken)
{
return File.WriteAllTextAsync(path, contents, cancellationToken);
Expand Down
Loading