fix: report launcher failures by operation stage
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using Launcher.Next.Application;
|
||||
using Xunit;
|
||||
|
||||
namespace Launcher.Next.Tests;
|
||||
|
||||
public sealed class OwnerReviewStateTests
|
||||
{
|
||||
[Fact]
|
||||
public void MissingAutomaticRoster_IsRosterFailure_NotProcessStartFailure()
|
||||
{
|
||||
var failure = LauncherOperationFailures.Classify("LEGACY_DOWNLOAD_LIST_NOT_FOUND", "RosterResolutionFailed");
|
||||
Assert.Equal("RosterResolutionFailed", failure.Stage);
|
||||
Assert.Equal("AUTOMATIC_DOWNLOAD_LIST_NOT_FOUND", failure.Code);
|
||||
Assert.False(failure.ProcessStartAttempted);
|
||||
Assert.DoesNotContain("запустить Autodesk", failure.UserMessage, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("LEGACY_DOWNLOAD_SELECTION_INVALID", "PluginPlanFailed", "DOWNLOAD_LIST_INVALID")]
|
||||
[InlineData("LEGACY_PLUGIN_PRODUCT_MISMATCH", "PluginPlanFailed", "PLUGIN_PRODUCT_MISMATCH")]
|
||||
[InlineData("LEGACY_MAPPING_NOT_FOUND", "PackageMappingFailed", "PACKAGE_MAPPING_NOT_FOUND")]
|
||||
[InlineData("LOCAL_PARITY_ROSTER_PROFILE_MISMATCH", "RosterResolutionFailed", "OWNER_REVIEW_PROFILE_ROSTER_MISMATCH")]
|
||||
public void SelectionAndMappingErrors_KeepTheirOperationStage(string source, string stage, string code)
|
||||
{
|
||||
var failure = LauncherOperationFailures.Classify(source, "ProjectValidationFailed");
|
||||
Assert.Equal(stage, failure.Stage);
|
||||
Assert.Equal(code, failure.Code);
|
||||
Assert.False(failure.ProcessStartAttempted);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LaunchFailure_IsAttributedOnlyToActualProcessStartCode()
|
||||
{
|
||||
var failure = LauncherOperationFailures.Classify("PLANT3D_PROCESS_NOT_CREATED", "PackagePreparationFailed");
|
||||
Assert.Equal("ProcessStartFailed", failure.Stage);
|
||||
Assert.True(failure.ProcessStartAttempted);
|
||||
Assert.Equal("Не удалось запустить Autodesk", failure.UserMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnknownPreparationFailure_DoesNotBecomeProcessFailure()
|
||||
{
|
||||
var failure = LauncherOperationFailures.Classify("LOCAL_PARITY_PATTERN_NOT_FOUND", "PackagePreparationFailed");
|
||||
Assert.Equal("PackagePreparationFailed", failure.Stage);
|
||||
Assert.False(failure.ProcessStartAttempted);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user