Problem
System.IO.MemoryMappedFiles (MemoryMappedFile, MemoryMappedViewAccessor, MemoryMappedViewStream) has no abstraction. Code that memory-maps a file has no seam and cannot be exercised against MockFileSystem.
Scope
Core surface that would need mirroring:
MemoryMappedFile.CreateFromFile(...) (path and FileStream-based overloads), CreateNew(...), CreateOrOpen(...), OpenExisting(...)
MemoryMappedFile.CreateViewAccessor(...) → MemoryMappedViewAccessor
MemoryMappedFile.CreateViewStream(...) → MemoryMappedViewStream
Following the established pattern (cf. Testably.Abstractions.Compression), this would be a separate opt-in package exposing an IMemoryMappedFileFactory reachable via an extension method on IFileSystem (e.g. fileSystem.MemoryMappedFile()), with a real wrapper and a mock backed by the in-memory file storage.
Considerations / risks
MemoryMappedViewAccessor exposes SafeMemoryMappedViewHandle and Read/Write<T> of arbitrary structs at offsets — the mock would model these over the mock file's byte buffer, but pointer-level access (AcquirePointer) cannot be faithfully mocked.
- Named maps (cross-process shared memory via
mapName) are an OS/IPC concept with no in-memory analogue; scope the mock to file-backed maps and document named/cross-process maps as unsupported.
Problem
System.IO.MemoryMappedFiles(MemoryMappedFile,MemoryMappedViewAccessor,MemoryMappedViewStream) has no abstraction. Code that memory-maps a file has no seam and cannot be exercised againstMockFileSystem.Scope
Core surface that would need mirroring:
MemoryMappedFile.CreateFromFile(...)(path andFileStream-based overloads),CreateNew(...),CreateOrOpen(...),OpenExisting(...)MemoryMappedFile.CreateViewAccessor(...)→MemoryMappedViewAccessorMemoryMappedFile.CreateViewStream(...)→MemoryMappedViewStreamFollowing the established pattern (cf.
Testably.Abstractions.Compression), this would be a separate opt-in package exposing anIMemoryMappedFileFactoryreachable via an extension method onIFileSystem(e.g.fileSystem.MemoryMappedFile()), with a real wrapper and a mock backed by the in-memory file storage.Considerations / risks
MemoryMappedViewAccessorexposesSafeMemoryMappedViewHandleandRead/Write<T>of arbitrary structs at offsets — the mock would model these over the mock file's byte buffer, but pointer-level access (AcquirePointer) cannot be faithfully mocked.mapName) are an OS/IPC concept with no in-memory analogue; scope the mock to file-backed maps and document named/cross-process maps as unsupported.