Class ProjectFileBytesSnapshot
The bytes of every file under a set of project folders, and of any single project files named beside them,
taken at one moment — .meta files included — so a test can name exactly the files a run wrote. Every
pending asset write is flushed before the files are read, so an unsaved change is never missed and a change an
earlier test left unsaved is never blamed on this one.
Each file is kept as its length and a 64-bit FNV-1a fingerprint of its bytes — enough to catch an accidental change, without a copy of the tree in memory or a cryptographic hash, which under the editor's runtime made one snapshot of the package tree take over ten seconds. Opening every file is the remaining cost, so a fingerprint is remembered with the length and last write time it was read at and reused while both are unchanged: only a write that kept a file's length and restored its timestamp could slip past, and no tool a test drives does that. A file written within Serenity.Tests.Shared.Editor.ProjectFileBytesSnapshot.RecentWriteWindow of being read is never remembered, because a second write inside the file system's timestamp resolution would keep the same timestamp.
Inherited Members
Namespace: Serenity.Tests.Shared.Editor
Assembly: Serenity.Tests.Shared.Editor.dll
Syntax
public sealed class ProjectFileBytesSnapshot
Methods
FilesChangedSince()
The files whose bytes differ from this snapshot — changed, created or deleted since — after flushing every pending asset write, in ordinal order.
Declaration
public List<string> FilesChangedSince()
Returns
| Type | Description |
|---|---|
| List<string> |
Take(IReadOnlyList<string>)
Flushes every pending asset write, then reads every file under paths (a folder
contributes every file beneath it, a file itself; a path that does not exist contributes nothing).
Declaration
public static ProjectFileBytesSnapshot Take(IReadOnlyList<string> paths)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<string> | paths |
Returns
| Type | Description |
|---|---|
| ProjectFileBytesSnapshot |