Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZipExtensionWrapper class added with unit tests. #693

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Teigler
Copy link
Member

@Teigler Teigler commented Jan 24, 2025

Zu finden in DataAccess/Extensions/ZipExtensionWrapper

@Teigler Teigler requested review from niklasstich and andreasweishaupt and removed request for niklasstich January 24, 2025 09:08
@coveralls
Copy link

coveralls commented Jan 24, 2025

Pull Request Test Coverage Report for Build 12946571648

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 18 of 30 (60.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 94.169%

Changes Missing Coverage Covered Lines Changed/Added Lines %
DataAccess/Extensions/ZipExtensions.cs 18 20 90.0%
DataAccess/Extensions/ZipExtensionWrapper.cs 0 10 0.0%
Totals Coverage Status
Change from base Build 12941021203: -0.05%
Covered Lines: 17231
Relevant Lines: 18298

💛 - Coveralls

CreateFromDirectoryAsync_NoWritePermission_ThrowsUnauthorizedAccessException updated with NSubstitute.
Fix von CreateFromDirectoryAsync_NoWritePermission_ThrowsUnauthorizedAccessException() test using NSubstitute.

namespace DataAccessTest.Extensions;
[TestFixture]
public class ZipExtensionUnitTest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sollte dann ZipExtensionsWrapperUt heißen.

{
_mockFileSystem = new MockFileSystem();
}
public ZipExtensionWrapper CreateZipExtensionWrapper(IFileSystem? fileSystem = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kann private sein.


namespace DataAccess.Extensions;
/// <inheritdoc cref="ZipExtension"/>
public class ZipExtensionWrapper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Da die Klasse, auf die sich der Wrapper bezieht ZipExtensions heißt, sollte auch der Wrapper ZipExtensionsWrapper heißen.

FileSystem = fileSystem;
}

/// <inheritdoc cref="ZipExtension.GetZipArchive"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die doc kann nicht einfach so übernommen werden, da es den Parameter für das FileSystem im Wrapper nicht mehr gibt.

return memoryStream;
}

private static MemoryStream CreateMemmoryStreamWithZipArchive()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*CreateMemoryStreamWithZipArchive()

/// Implementing tested with OpenRead. It would be better if a mock file would be constructed using the TestingHelpers that we are not allowed to access.
/// </summary>
[Test]
public void GetZipArchiveAccessIsDenied_ThrowsUnauthorizedAccessException()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*GetZipArchive_AccessIsDenied_ThrowsUnauthorizedAccessException()
Besser lesbar, da die zu testende Methode vor dem ersten Unterstrich steht.

/// Implementing tested with OpenRead. It would be better if a mock file would be constructed using the TestingHelpers that we are not allowed to access.
/// </summary>
[Test]
public void GetZipArchiveFileCannotBeRead_ThrowsIOException()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*GetZipArchive_FileCannotBeRead_ThrowsIOException()

@@ -0,0 +1,648 @@
using DataAccess.Extensions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests, die aus plattformspezifischen Gründen fehlschlagen, müssen mit einer plattformunabhängigen Möglichkeit, Pfade zu erstellen, überarbeitet werden.
Pfade in den Tests müssen in Abhängigkeit des aktuellen Betriebssystems erstellt werde.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants