Skip to content

Commit b259283

Browse files
committed
Merge from main
2 parents bb98792 + 1bcd79f commit b259283

File tree

54 files changed

+1625
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1625
-198
lines changed

.github/coverage-settings.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://learn.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-coverage#settings -->
3+
4+
<Configuration>
5+
<CodeCoverage>
6+
<Attributes>
7+
<Exclude>
8+
<Attribute>^System\.ObsoleteAttribute$</Attribute>
9+
<Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
10+
<Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
11+
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
12+
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
13+
</Exclude>
14+
</Attributes>
15+
</CodeCoverage>
16+
</Configuration>

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
dotnet tool install --global dotnet-coverage
5858
dotnet restore -s 'nuget.config'
5959
dotnet build --no-incremental /p:NetCoreOnly=True --configuration "Release"
60-
dotnet-coverage collect 'dotnet test --no-build' -f xml -o 'coverage.xml'
60+
dotnet-coverage collect 'dotnet test --no-build' -f xml -o 'coverage.xml' -s '.github\coverage-settings.xml'
6161
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
6262
6363
test-macos:

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ jobs:
2525
with:
2626
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2727
- name: Tag current commit
28-
id: tag
2928
shell: bash
3029
run: |
3130
version="${GITHUB_REF#refs/heads/release/}"
3231
git tag "${version}"
33-
echo "release_version=${version}" >> "$GITHUB_OUTPUT"
3432
- name: Cache SonarCloud packages
3533
uses: actions/cache@v3
3634
with:
@@ -65,7 +63,7 @@ jobs:
6563
dotnet tool install --global dotnet-coverage
6664
dotnet restore -s 'nuget.config'
6765
dotnet build --no-incremental /p:NetCoreOnly=True --configuration "Release"
68-
dotnet-coverage collect 'dotnet test --no-build' -f xml -o 'coverage.xml'
66+
dotnet-coverage collect 'dotnet test --no-build' -f xml -o 'coverage.xml' -s '.github\coverage-settings.xml'
6967
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
7068
7169
test-macos:
@@ -281,11 +279,13 @@ jobs:
281279
with:
282280
fetch-depth: 0
283281
- name: Tag current commit
282+
id: tag
284283
shell: bash
285284
run: |
286285
version="${GITHUB_REF#refs/heads/release/}"
287286
git tag "${version}"
288287
git push origin "${version}"
288+
echo "release_version=${version}" >> "$GITHUB_OUTPUT"
289289
- name: Setup NuGet
290290
uses: NuGet/[email protected]
291291
- name: Setup .NET

Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ItemGroup>
88
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
99
<PackageVersion Include="System.Threading.Channels" Version="7.0.0" />
10-
<PackageVersion Include="TestableIO.System.IO.Abstractions" Version="19.2.64" />
11-
<PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="19.2.64" />
10+
<PackageVersion Include="TestableIO.System.IO.Abstractions" Version="19.2.67" />
11+
<PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="19.2.67" />
1212
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
1313
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
1414
</ItemGroup>
@@ -26,7 +26,7 @@
2626

2727
<ItemGroup>
2828
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.0" />
29-
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
29+
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
3030
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
3131
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
3232
<PackageVersion Include="xunit" Version="2.5.0" />
@@ -36,8 +36,8 @@
3636
</ItemGroup>
3737

3838
<ItemGroup>
39-
<PackageVersion Include="Testably.Abstractions" Version="2.3.4" />
40-
<PackageVersion Include="Testably.Abstractions.Testing" Version="2.3.4" />
39+
<PackageVersion Include="Testably.Abstractions" Version="2.4.1" />
40+
<PackageVersion Include="Testably.Abstractions.Testing" Version="2.4.1" />
4141
<PackageVersion Include="Testably.Abstractions.FluentAssertions" Version="0.6.0" />
4242
</ItemGroup>
4343

Feature.Flags.props

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project>
22

33
<PropertyGroup>
4-
<IS_NET21_OR_HIGHER Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'netstandard2.1'">1</IS_NET21_OR_HIGHER>
5-
<IS_NET6_OR_7 Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0'">1</IS_NET6_OR_7>
6-
<IS_NET7 Condition="'$(TargetFramework)' == 'net7.0'">1</IS_NET7>
7-
4+
<IS_NET21_OR_HIGHER Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'netstandard2.1'">1</IS_NET21_OR_HIGHER>
5+
<IS_NET6_OR_HIGHER Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net8.0'">1</IS_NET6_OR_HIGHER>
6+
<IS_NET7_OR_HIGHER Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net8.0'">1</IS_NET7_OR_HIGHER>
7+
88
<DefineConstants Condition="'$(TargetFramework)' == 'net48' OR '$(TargetFramework)' == 'netstandard2.0'">$(DefineConstants);NETFRAMEWORK</DefineConstants>
99
<DefineConstants Condition="'$(IS_NET21_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_ASYNC</DefineConstants>
1010
<DefineConstants Condition="'$(IS_NET21_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_ENUMERATION_OPTIONS</DefineConstants>
@@ -16,18 +16,18 @@
1616
<DefineConstants Condition="'$(IS_NET21_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_COMPRESSION_OVERWRITE</DefineConstants>
1717
<DefineConstants Condition="'$(IS_NET21_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_COMPRESSION_ADVANCED</DefineConstants>
1818
<DefineConstants Condition="'$(IS_NET21_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_ASYNC_DISPOSABLE</DefineConstants>
19-
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_STREAM_OPTIONS</DefineConstants>
20-
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_LINK</DefineConstants>
21-
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_PATH_ADVANCED</DefineConstants>
22-
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_FILE_MOVETO_OVERWRITE</DefineConstants>
23-
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_RANDOM_ADVANCED</DefineConstants>
24-
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEMWATCHER_ADVANCED</DefineConstants>
25-
<DefineConstants Condition="'$(IS_NET6_OR_7)' == '1'">$(DefineConstants);FEATURE_EXCEPTION_HRESULT</DefineConstants>
26-
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_ZIPFILE_NET7</DefineConstants>
27-
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_NET7</DefineConstants>
28-
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_SAFEFILEHANDLE</DefineConstants>
29-
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_UNIXFILEMODE</DefineConstants>
30-
<DefineConstants Condition="'$(IS_NET7)' == '1'">$(DefineConstants);FEATURE_GUID_FORMATPROVIDER</DefineConstants>
19+
<DefineConstants Condition="'$(IS_NET6_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_STREAM_OPTIONS</DefineConstants>
20+
<DefineConstants Condition="'$(IS_NET6_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_LINK</DefineConstants>
21+
<DefineConstants Condition="'$(IS_NET6_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_PATH_ADVANCED</DefineConstants>
22+
<DefineConstants Condition="'$(IS_NET6_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILE_MOVETO_OVERWRITE</DefineConstants>
23+
<DefineConstants Condition="'$(IS_NET6_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_RANDOM_ADVANCED</DefineConstants>
24+
<DefineConstants Condition="'$(IS_NET6_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEMWATCHER_ADVANCED</DefineConstants>
25+
<DefineConstants Condition="'$(IS_NET6_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_EXCEPTION_HRESULT</DefineConstants>
26+
<DefineConstants Condition="'$(IS_NET7_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_ZIPFILE_NET7</DefineConstants>
27+
<DefineConstants Condition="'$(IS_NET7_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_NET7</DefineConstants>
28+
<DefineConstants Condition="'$(IS_NET7_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_SAFEFILEHANDLE</DefineConstants>
29+
<DefineConstants Condition="'$(IS_NET7_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_FILESYSTEM_UNIXFILEMODE</DefineConstants>
30+
<DefineConstants Condition="'$(IS_NET7_OR_HIGHER)' == '1'">$(DefineConstants);FEATURE_GUID_FORMATPROVIDER</DefineConstants>
3131
</PropertyGroup>
3232

3333
</Project>
Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,120 @@
1-
using System.IO.Compression;
1+
using System.IO;
2+
using System.IO.Compression;
23
using System.Text;
34

45
namespace Testably.Abstractions;
56

67
/// <inheritdoc cref="ZipFile" />
78
public interface IZipFile : IFileSystemEntity
89
{
10+
#if FEATURE_COMPRESSION_STREAM
11+
/// <inheritdoc cref="ZipFile.CreateFromDirectory(string, Stream)" />
12+
void CreateFromDirectory(
13+
string sourceDirectoryName,
14+
Stream destination);
15+
16+
/// <inheritdoc cref="ZipFile.CreateFromDirectory(string, Stream, CompressionLevel, bool)" />
17+
void CreateFromDirectory(
18+
string sourceDirectoryName,
19+
Stream destination,
20+
CompressionLevel compressionLevel,
21+
bool includeBaseDirectory);
22+
23+
/// <inheritdoc cref="ZipFile.CreateFromDirectory(string, Stream, CompressionLevel, bool, Encoding)" />
24+
void CreateFromDirectory(
25+
string sourceDirectoryName,
26+
Stream destination,
27+
CompressionLevel compressionLevel,
28+
bool includeBaseDirectory,
29+
Encoding entryNameEncoding);
30+
#endif
31+
932
/// <inheritdoc cref="ZipFile.CreateFromDirectory(string, string)" />
10-
void CreateFromDirectory(string sourceDirectoryName,
33+
void CreateFromDirectory(
34+
string sourceDirectoryName,
1135
string destinationArchiveFileName);
1236

1337
/// <inheritdoc cref="ZipFile.CreateFromDirectory(string, string, CompressionLevel, bool)" />
14-
void CreateFromDirectory(string sourceDirectoryName,
38+
void CreateFromDirectory(
39+
string sourceDirectoryName,
1540
string destinationArchiveFileName,
1641
CompressionLevel compressionLevel,
1742
bool includeBaseDirectory);
1843

1944
/// <inheritdoc cref="ZipFile.CreateFromDirectory(string, string, CompressionLevel, bool, Encoding)" />
20-
void CreateFromDirectory(string sourceDirectoryName,
45+
void CreateFromDirectory(
46+
string sourceDirectoryName,
2147
string destinationArchiveFileName,
2248
CompressionLevel compressionLevel,
2349
bool includeBaseDirectory,
2450
Encoding entryNameEncoding);
2551

52+
#if FEATURE_COMPRESSION_STREAM
53+
/// <inheritdoc cref="ZipFile.ExtractToDirectory(Stream, string)" />
54+
void ExtractToDirectory(
55+
Stream source,
56+
string destinationDirectoryName);
57+
58+
/// <inheritdoc cref="ZipFile.ExtractToDirectory(Stream, string, bool)" />
59+
void ExtractToDirectory(
60+
Stream source,
61+
string destinationDirectoryName,
62+
bool overwriteFiles);
63+
64+
/// <inheritdoc cref="ZipFile.ExtractToDirectory(Stream, string, Encoding)" />
65+
void ExtractToDirectory(
66+
Stream source,
67+
string destinationDirectoryName,
68+
Encoding entryNameEncoding);
69+
70+
/// <inheritdoc cref="ZipFile.ExtractToDirectory(Stream, string, Encoding, bool)" />
71+
void ExtractToDirectory(
72+
Stream source,
73+
string destinationDirectoryName,
74+
Encoding entryNameEncoding,
75+
bool overwriteFiles);
76+
#endif
77+
2678
/// <inheritdoc cref="ZipFile.ExtractToDirectory(string, string)" />
27-
void ExtractToDirectory(string sourceArchiveFileName,
79+
void ExtractToDirectory(
80+
string sourceArchiveFileName,
2881
string destinationDirectoryName);
2982

3083
#if FEATURE_COMPRESSION_OVERWRITE
3184
/// <inheritdoc cref="ZipFile.ExtractToDirectory(string, string, bool)" />
32-
void ExtractToDirectory(string sourceArchiveFileName,
85+
void ExtractToDirectory(
86+
string sourceArchiveFileName,
3387
string destinationDirectoryName,
3488
bool overwriteFiles);
3589
#endif
3690

3791
/// <inheritdoc cref="ZipFile.ExtractToDirectory(string, string, Encoding?)" />
38-
void ExtractToDirectory(string sourceArchiveFileName,
92+
void ExtractToDirectory(
93+
string sourceArchiveFileName,
3994
string destinationDirectoryName,
4095
Encoding? entryNameEncoding);
4196

4297
#if FEATURE_COMPRESSION_OVERWRITE
4398
/// <inheritdoc cref="ZipFile.ExtractToDirectory(string, string, Encoding?, bool)" />
44-
void ExtractToDirectory(string sourceArchiveFileName,
99+
void ExtractToDirectory(
100+
string sourceArchiveFileName,
45101
string destinationDirectoryName,
46102
Encoding? entryNameEncoding,
47103
bool overwriteFiles);
48104
#endif
49105

50106
/// <inheritdoc cref="ZipFile.Open(string, ZipArchiveMode)" />
51-
IZipArchive Open(string archiveFileName,
107+
IZipArchive Open(
108+
string archiveFileName,
52109
ZipArchiveMode mode);
53110

54111
/// <inheritdoc cref="IZipFile.Open(string, ZipArchiveMode, Encoding?)" />
55-
IZipArchive Open(string archiveFileName,
112+
IZipArchive Open(
113+
string archiveFileName,
56114
ZipArchiveMode mode,
57115
Encoding? entryNameEncoding);
58116

59117
/// <inheritdoc cref="ZipFile.OpenRead(string)" />
60-
IZipArchive OpenRead(string archiveFileName);
118+
IZipArchive OpenRead(
119+
string archiveFileName);
61120
}

0 commit comments

Comments
 (0)