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

feat: enable mocking the IFileVersionInfo #704

Merged
merged 15 commits into from
Jan 10, 2025

Conversation

vbreuss
Copy link
Member

@vbreuss vbreuss commented Jan 10, 2025

Add a method to the MockFileSystem that allows setting the IFileVersionInfo:

MockFileSystem fileSystem = new();
fileSystem.WithFileVersionInfo("foo.dll", b => b.SetFileVersion("2.3.4"));
fileSystem.Initialize().WithFile("foo.dll");

IFileVersionInfo fileVersionInfo = fileSystem.FileVersionInfo.GetVersionInfo("foo.dll");
fileVersionInfo.FileVersion.Should().Be("2.3.4");

@vbreuss vbreuss added the enhancement New feature or request label Jan 10, 2025
@vbreuss vbreuss self-assigned this Jan 10, 2025
Copy link

github-actions bot commented Jan 10, 2025

Test Results

     46 files  ±      0       46 suites  ±0   22m 0s ⏱️ + 20m 6s
 55 196 tests + 52 008   52 222 ✅ +49 074   2 974 💤 + 2 934  0 ❌ ±0 
114 383 runs  +105 357  102 082 ✅ +93 261  12 301 💤 +12 096  0 ❌ ±0 

Results for commit 499bb0e. ± Comparison against base commit 2f6e114.

This pull request removes 2375 and adds 54383 tests. Note that renamed tests count towards both.
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [115, 33, 128])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [17, 123, 68])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [201, 127, 83])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [228, 21, 100])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [236, 186, 77])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [40, 47, 21])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [52, 170, 107])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [56, 251, 88])
Testably.Abstractions.Compression.Tests.Internal.ZipUtilitiesTests ‑ ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(bytes: [72, 180, 51])
Testably.Abstractions.Testing.Tests.FileSystem.ChangeDescriptionTests ‑ ToString_ShouldIncludeChangeType(changeType: Created, fileSystemType: Directory, notifyFilters: FileName, path: "path228f20bf-57af-4f88-99d0-ccd22ad8b02a")
…
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests.MockFileSystemTests ‑ GetExtensibilityOrThrow_DirectoryInfo_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests.MockFileSystemTests ‑ GetExtensibilityOrThrow_FileInfo_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests.MockFileSystemTests ‑ GetExtensibilityOrThrow_FileSystemStream_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests.RealFileSystemTests ‑ GetExtensibilityOrThrow_DirectoryInfo_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests.RealFileSystemTests ‑ GetExtensibilityOrThrow_FileInfo_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.AccessControlHelperTests.RealFileSystemTests ‑ GetExtensibilityOrThrow_FileSystemStream_ShouldNotThrow
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests.MockFileSystemTests ‑ CreateDirectory_NullDirectorySecurity_ShouldThrowArgumentNullException
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests.MockFileSystemTests ‑ CreateDirectory_ShouldChangeAccessControl(path: "bar")
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests.MockFileSystemTests ‑ CreateDirectory_ShouldChangeAccessControl(path: "bar\\foo")
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests.MockFileSystemTests ‑ GetAccessControl_ShouldBeInitializedWithNotNullValue
…
This pull request removes 39 skipped tests and adds 2973 skipped tests. Note that renamed tests count towards both.
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(path: "path394543de-6981-44cd-b1ce-ce58abbd545d")
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(path: "path96a453dd-5225-4654-9285-0836604ea07e")
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(path: "pathbe187af5-d1be-49d8-bde9-0cef80a03f2c")
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(path: "pathe8c7704d-0d68-4a94-b0d2-eb1af3d65954")
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ SetUnixFileMode_SafeFileHandle_ShouldUpdateValue(path: "pathc793e8e4-7100-4020-b105-3fcd836fa03b", mode: None)
Testably.Abstractions.Testing.Tests.FileSystem.FileMockTests ‑ SetUnixFileMode_SafeFileHandle_ShouldUpdateValue(path: "pathebbde5e2-37b7-43f8-b87d-73a29d0aa9f9", mode: None)
Testably.Abstractions.Testing.Tests.FileSystem.FileSystemWatcherMockTests ‑ InternalBufferSize_ShouldResetQueue(path1: "path10e6ef0e6-7a0e-40be-bcd0-d6e7326694b9", path2: "path21513ed1d-3fbe-474e-a72f-88ad1a5d65ca")
Testably.Abstractions.Testing.Tests.FileSystem.FileSystemWatcherMockTests ‑ InternalBufferSize_ShouldResetQueue(path1: "path11536e61f-674a-45fa-b760-89f5c7c4bc02", path2: "path26374741e-c324-4595-b135-1d8dad7a4007")
Testably.Abstractions.Testing.Tests.FileSystem.FileSystemWatcherMockTests ‑ InternalBufferSize_ShouldResetQueue(path1: "path160876ba3-2eff-48b6-8400-53c5fa8313d5", path2: "path2a0e3eb46-ed76-4553-9041-6cc957fd2f9e")
Testably.Abstractions.Testing.Tests.FileSystem.FileSystemWatcherMockTests ‑ InternalBufferSize_ShouldResetQueue(path1: "path166d0cc0f-0f1c-4f0d-8f25-88d696ea93ce", path2: "path2fc7b2df7-77dd-44a5-9041-2b86957575ce")
…
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests.RealFileSystemTests ‑ GetAccessControl_ShouldReturnSetResult
Testably.Abstractions.AccessControl.Tests.DirectoryAclExtensionsTests.RealFileSystemTests ‑ GetAccessControl_WithAccessControlSections_ShouldReturnSetResult
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.MockFileSystemTests ‑ SetAccessControl_ShouldNotUpdateTimes(path: "path3a308d9a-9f65-416a-9420-3e08cefdc684")
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.MockFileSystemTests ‑ SetAccessControl_ShouldNotUpdateTimes(path: "path65563600-353a-4591-af4e-eb2fa7afd7d3")
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.MockFileSystemTests ‑ SetAccessControl_ShouldNotUpdateTimes(path: "path70276132-dea3-44d7-987c-82917b4dca85")
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.MockFileSystemTests ‑ SetAccessControl_ShouldNotUpdateTimes(path: "pathb5bb3208-2d64-4a44-8b00-68785aefe8bd")
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.MockFileSystemTests ‑ SetAccessControl_ShouldNotUpdateTimes(path: "pathbfc41fdb-7988-4585-a6cc-2d272b0fc2b1")
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.MockFileSystemTests ‑ SetAccessControl_ShouldNotUpdateTimes(path: "pathd0fd6ce4-6b99-4b0d-9a0d-e5ded32ea7c1")
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.RealFileSystemTests ‑ GetAccessControl_ShouldReturnSetResult
Testably.Abstractions.AccessControl.Tests.DirectoryInfoAclExtensionsTests.RealFileSystemTests ‑ GetAccessControl_WithAccessControlSections_ShouldReturnSetResult
…

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jan 10, 2025

👽 Mutation Results

Mutation testing badge

Testably.Abstractions.Testing

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
FileSystem/FileVersionInfoFactoryMock.cs 25.00% 1 0 0 3 1 0 1 3 5
FileSystem/FileVersionInfoMock.cs 0.00% 0 0 0 54 1 0 0 54 55
Initializer/FileVersionInfoBuilder.cs 0.00% 0 0 0 18 0 0 0 18 18
MockFileSystem.cs 85.71% 18 0 0 3 5 0 18 3 26
Storage/FileVersionInfoContainer.cs 0.00% 0 0 0 24 11 0 0 24 35
Storage/InMemoryStorage.cs 7.37% 21 1 0 263 102 71 21 264 458

The final mutation score is 9.85%

Coverage Thresholds: high:80 low:60 break:0

Testably.Abstractions.AccessControl

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

Testably.Abstractions.Compression

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

Testably.Abstractions

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
FileSystem\FileVersionInfoWrapper.cs 0.00% 0 3 0 0 1 0 0 3 4

The final mutation score is 0.00%

Coverage Thresholds: high:80 low:60 break:0

@vbreuss vbreuss force-pushed the topic/add-fileversioninfo-for-testing branch from aaefb04 to 6e3ff2d Compare January 10, 2025 08:13
@vbreuss vbreuss force-pushed the topic/add-fileversioninfo-for-testing branch from 74c8fd1 to c6359a3 Compare January 10, 2025 11:53
@vbreuss vbreuss marked this pull request as ready for review January 10, 2025 13:03
@vbreuss vbreuss enabled auto-merge (squash) January 10, 2025 13:03
@vbreuss vbreuss merged commit 9406d1f into main Jan 10, 2025
15 checks passed
@vbreuss vbreuss deleted the topic/add-fileversioninfo-for-testing branch January 10, 2025 14:16
Copy link

github-actions bot commented Feb 1, 2025

This is addressed in release v4.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request state: released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant