Logic tests for failure mapping, the folder path in replanning, nickname-less cards, entry tooltips, left-to-right paths and the right-to-left session arrow; the smoke test runs every state at 1200 x 788 and checks names on every button, uncut session times and Show plan names, aligned headers, the folder path error only for Folder with its status action, four-digit number boxes, disabled devices with their reason, live regions and the locked form after an import, plus a right-to-left pass in Arabic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
42 lines
2.3 KiB
C#
42 lines
2.3 KiB
C#
using System.Globalization;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using Titano.App.Import;
|
|
using Titano.Core.Import;
|
|
using Titano.Core.Localization;
|
|
using Titano.Protocol;
|
|
using Titano.Protocol.Client;
|
|
using Titano.Testing;
|
|
|
|
namespace Titano.App.Tests.Import;
|
|
|
|
/// <summary>A stopped import or plan says what happened in one localized sentence, never the exception's raw text.</summary>
|
|
public sealed class ImportFailuresTests
|
|
{
|
|
public ImportFailuresTests() => Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
|
|
|
[Test]
|
|
public void AnImportFailureIsOneSentenceByCause()
|
|
{
|
|
const string Card = "EOS R5 · card A";
|
|
Assert.Equal("EOS R5 · card A is no longer available.", ImportFailures.Import(new ImportSourceUnavailableException(@"C:\Users\me\AppData\Local\Temp\card\"), Card));
|
|
Assert.Equal("The destination is full.", ImportFailures.Import(new IOException("There is not enough space on the disk.", unchecked((int)0x80070070)), Card));
|
|
Assert.Equal("Titano may not write to the destination.", ImportFailures.Import(new UnauthorizedAccessException(@"Access to D:\Shoots is denied."), Card));
|
|
Assert.Equal("The server did not accept the photos.", ImportFailures.Import(new HttpRequestException("No such host is known."), Card));
|
|
Assert.Equal("The server did not accept the photos.",
|
|
ImportFailures.Import(new TitanoApiException(HttpStatusCode.InsufficientStorage, new ApiError("quota", "Quota exceeded", null)), Card));
|
|
Assert.Equal("The import stopped before the end.", ImportFailures.Import(new InvalidDataException("Bad sidecar. Second sentence."), Card));
|
|
}
|
|
|
|
[Test]
|
|
public void APlanningFailureNamesTheSource()
|
|
{
|
|
const string Folder = @"D:\Shoots";
|
|
Assert.Equal(@"D:\Shoots is no longer available.", ImportFailures.Plan(new DirectoryNotFoundException(@"Could not find a part of the path 'D:\Shoots\DCIM'."), Folder));
|
|
Assert.Equal(@"D:\Shoots could not be read.", ImportFailures.Plan(new UnauthorizedAccessException("Access denied."), Folder));
|
|
Assert.Equal(@"D:\Shoots could not be read.", ImportFailures.Plan(new IOException("The device is not ready."), Folder));
|
|
Assert.Equal("The import could not be planned.", ImportFailures.Plan(new InvalidOperationException("Sequence contains no elements"), Folder));
|
|
}
|
|
}
|