Skip to content

Commit

Permalink
Revert "ZipExtensionWrapperUt updated"
Browse files Browse the repository at this point in the history
This reverts commit 1e59c91.
  • Loading branch information
defnegoncu committed Jan 29, 2025
1 parent 1e59c91 commit 3caad1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion AuthoringTool/electron.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"appId": "com.AuthoringTool.app",
"productName": "AuthoringTool",
"copyright": "Copyright © 2023 Team AdLer",
"buildVersion": "1.0.0",
"buildVersion": "2.2.2",
"compression": "maximum",
"directories": {
"output": "../../../bin/Desktop_Publish"
Expand Down
22 changes: 10 additions & 12 deletions DataAccessTest/Extensions/ZipExtensionWrapperUt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,22 +320,20 @@ public void CreateFromDirectoryAsync_NoWritePermission_ThrowsUnauthorizedAccessE
{
string sourcePath = @"C:\source";
string destinationPath = @"C:\output.zip";

_mockFileSystem.AddDirectory(sourcePath);
_mockFileSystem.AddFile(Path.Combine(sourcePath, "file1.txt"), new MockFileData("File content"));

var fileSystemMock = Substitute.For<IFileSystem>();
fileSystemMock.FileSystemWatcher.Returns(_mockFileSystem.FileSystemWatcher);
fileSystemMock.Directory.Returns(_mockFileSystem.Directory);
fileSystemMock.File.OpenWrite(Arg.Any<string>())
.Throws(new UnauthorizedAccessException("Simulated Unauthorized Access"));

var systemUnderTest = CreateZipExtensionWrapper(fileSystemMock);

_mockFileSystem.AddFile(Path.Combine(sourcePath, "file1.txt"), new MockFileData("File1 content"));
_mockFileSystem.AddFile(destinationPath, new MockFileData("Existing content")
{
Attributes = FileAttributes.ReadOnly
});

var systemUnderTest = CreateZipExtensionWrapper(_mockFileSystem);
var exception = Assert.ThrowsAsync<UnauthorizedAccessException>(async () =>
await systemUnderTest.CreateFromDirectoryAsync(sourcePath, destinationPath));

Assert.That(exception, Is.Not.Null);
Assert.That(exception.Message, Contains.Substring("Simulated Unauthorized Access"));
Assert.That(exception.Message, Contains.Substring("Access to the path"));
}


Expand Down

0 comments on commit 3caad1f

Please sign in to comment.