chore: bootstrap repository foundation
Solution layout, build rules with zero-package guard, in-house test framework, localization runtime, brand mark rasteriser with ICO/PNG generation, Core contracts (imaging, video, domain model, TIFF reader), Titano.Tools (make-icon, i18n, xaml-lint, package-guard) and docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
109 files changed
+7523
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using Titano.Core.IO;
|
||||
using Titano.Testing;
|
||||
|
||||
namespace Titano.Core.Tests.Foundation;
|
||||
|
||||
public sealed class AtomicFileTests(TestContext context)
|
||||
{
|
||||
[Test]
|
||||
public void ReplacesContentAndLeavesNoTemporaryFiles()
|
||||
{
|
||||
var dir = context.CreateTempDirectory();
|
||||
var path = Path.Combine(dir, "sequence.json");
|
||||
AtomicFile.WriteAllText(path, "one");
|
||||
AtomicFile.WriteAllText(path, "two");
|
||||
Assert.Equal("two", File.ReadAllText(path));
|
||||
Assert.Count(1, Directory.GetFiles(dir));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task FailedWriteKeepsPreviousContent()
|
||||
{
|
||||
var dir = context.CreateTempDirectory();
|
||||
var path = Path.Combine(dir, "project.json");
|
||||
AtomicFile.WriteAllText(path, "stable");
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(() => AtomicFile.WriteAsync(path, async (s, ct) =>
|
||||
{
|
||||
await s.WriteAsync("partial"u8.ToArray(), ct);
|
||||
throw new InvalidOperationException("boom");
|
||||
}));
|
||||
Assert.Equal("stable", File.ReadAllText(path));
|
||||
Assert.Count(1, Directory.GetFiles(dir));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user