test(tapes): the tapes window, the choice asked before a start, the wheels and the doors from the other cab

- HaslerTapeWindow: with nothing recorded it offers to record and turns on the
  black box and the trains' tapes; a tape of the last launch is summed up with
  its scenario and train, and is no longer followed once the window closes.
- HaslerTapes.Load: a log begun anew over the end that was read is read whole
  once its time goes back; an unreadable tape is none and told in the log; a
  file read only forward is read whole each time. Empty log lines are passed over.
- MessageBox.Choose: the answer clicked, or none on the way back or on closing.
- CabPanel: wheels turning apart from the train are said beside its speed.
- EventList: going to the other cab tells nothing of the doors, still the switches.
- WarehouseEditTests and ConsistOrientationTests put in app-wide services of
  their own: they now wait their turn with the controls that read them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maj00r
2026-11-16 15:58:31 +01:00
parent fa8ae760e1
commit f0fa2d1768
9 changed files with 335 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ public sealed class InMemoryFileSystem : IFileSystem
private readonly HashSet<string> _executable;
private readonly Dictionary<string, string> _links;
private readonly HashSet<string> _unreadable;
private readonly HashSet<string> _unseekable;
private readonly HashSet<string> _unlistable;
private readonly Dictionary<string, DateTime> _written;
@@ -32,6 +33,7 @@ public sealed class InMemoryFileSystem : IFileSystem
_executable = new HashSet<string>(comparer);
_links = new Dictionary<string, string>(comparer);
_unreadable = new HashSet<string>(comparer);
_unseekable = new HashSet<string>(comparer);
_unlistable = new HashSet<string>(comparer);
_written = new Dictionary<string, DateTime>(comparer);
}
@@ -51,6 +53,13 @@ public sealed class InMemoryFileSystem : IFileSystem
return this;
}
/// <summary>The file opens as a stream read only forward, as a pipe or some network shares give it.</summary>
public InMemoryFileSystem OpenedForwardOnly(string path)
{
_unseekable.Add(Normalize(path));
return this;
}
public InMemoryFileSystem AllowReading(string path)
{
_unreadable.Remove(Normalize(path));
@@ -115,7 +124,11 @@ public sealed class InMemoryFileSystem : IFileSystem
public byte[] ReadAllBytes(string path) => Bytes(path);
public Stream OpenRead(string path) => new MemoryStream(Bytes(path), writable: false);
public Stream OpenRead(string path)
{
var stream = new MemoryStream(Bytes(path), writable: false);
return _unseekable.Contains(Normalize(path)) ? new ForwardOnlyStream(stream) : stream;
}
public void WriteAllText(string path, string contents) => WithFile(path, contents);