Skip to content

Commit

Permalink
PR #587: Remove supported method checks from ZipEntry.CompressionMeth…
Browse files Browse the repository at this point in the history
…od setter
  • Loading branch information
Numpsy committed May 8, 2021
1 parent fa08c7d commit 99170e1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
6 changes: 1 addition & 5 deletions src/ICSharpCode.SharpZipLib/Zip/ZipEntry.cs
Expand Up @@ -724,17 +724,13 @@ public long Crc
/// <summary>
/// Gets/Sets the compression method.
/// </summary>
/// <remarks>Throws exception when set if the method is not valid as per <see cref="IsCompressionMethodSupported()"/></remarks>
/// <exception cref="NotSupportedException"/>
/// <returns>
/// The compression method for this entry
/// </returns>
public CompressionMethod CompressionMethod
{
get => method;
set => method = !IsCompressionMethodSupported(value)
? throw new NotSupportedException("Compression method not supported")
: value;
set => method = value;
}

/// <summary>
Expand Down
12 changes: 0 additions & 12 deletions test/ICSharpCode.SharpZipLib.Tests/Zip/GeneralHandling.cs
Expand Up @@ -133,18 +133,6 @@ private string DescribeAttributes(FieldAttributes attributes)
return att;
}

[Test]
[Category("Zip")]
//[ExpectedException(typeof(NotSupportedException))]
public void UnsupportedCompressionMethod()
{
var ze = new ZipEntry("HumblePie");
//ze.CompressionMethod = CompressionMethod.BZip2;

Assert.That(() => ze.CompressionMethod = CompressionMethod.Deflate64,
Throws.TypeOf<NotSupportedException>());
}

/// <summary>
/// Invalid passwords should be detected early if possible, seekable stream
/// Note: Have a 1/255 chance of failing due to CRC collision (hence retried once)
Expand Down

0 comments on commit 99170e1

Please sign in to comment.