Class AchievementDefinitionCreatorTests
EditMode tests for AchievementDefinitionCreator. Every fixture asset lives under a private
temp folder and every run passes RegisterAsAddressables = false, so the project's real achievements
and its Addressables settings are never touched. Mirrors AchievementSettingsCreatorTests.
Ids are prefixed pr11- and are slugs, because the duplicate-Id pass deliberately scans the WHOLE
project: a fixture id that collided with a shipped achievement would make an unrelated assertion fail.
Inherited Members
Namespace: Serenity.UnityAchievements.Tests.Editor
Assembly: Tests.Editor.dll
Syntax
public class AchievementDefinitionCreatorTests
Constructors
AchievementDefinitionCreatorTests()
Declaration
public AchievementDefinitionCreatorTests()
Methods
BeginEdit_ThenAnEditToTheLiveTree_IsUndoable()
The case BeginEdit(UnityAchievementDefinition, string) is for: a caller mutating the live tree itself, with no Input and no Update call anywhere in sight.
Declaration
public void BeginEdit_ThenAnEditToTheLiveTree_IsUndoable()
Create_InAFolderThatDoesNotExistYet_CreatesTheWholeFolderChain()
Declaration
public void Create_InAFolderThatDoesNotExistYet_CreatesTheWholeFolderChain()
Create_NamesTheAssetAfterTheId()
Declaration
public void Create_NamesTheAssetAfterTheId()
Create_TargetPathAlreadyOccupied_FailsAndLeavesTheExistingAchievementAlone()
Declaration
public void Create_TargetPathAlreadyOccupied_FailsAndLeavesTheExistingAchievementAlone()
Create_ValidInput_WritesEveryAuthoredFieldAndAFreshGuid()
Declaration
public void Create_ValidInput_WritesEveryAuthoredFieldAndAFreshGuid()
Create_WithAConditionTree_SerializesTheWholeTreeIntoTheAsset()
Declaration
public void Create_WithAConditionTree_SerializesTheWholeTreeIntoTheAsset()
Create_WithAnIcon_RoundTripsTheSpriteReferenceAndSilencesTheIconWarning()
Declaration
public void Create_WithAnIcon_RoundTripsTheSpriteReferenceAndSilencesTheIconWarning()
Create_WithoutAddressablesRegistration_LeavesTheAddressablesSettingsUntouched()
Declaration
public void Create_WithoutAddressablesRegistration_LeavesTheAddressablesSettingsUntouched()
Create_WriteFailsInAFolderThisRunHadToCreate_LeavesNoFolderBehindAndKeepsTheOnesItFound()
The folder this run had to create must be gone afterwards — and the folder it merely wrote into must not be, which is the half of a rollback that is easy to get wrong and impossible to notice.
Declaration
public void Create_WriteFailsInAFolderThisRunHadToCreate_LeavesNoFolderBehindAndKeepsTheOnesItFound()
Create_WriteFailsMidRun_RollsBackLeavingNothingBehind()
Declaration
public void Create_WriteFailsMidRun_RollsBackLeavingNothingBehind()
Delete_NothingToRemove_ReportsTheMissingTarget()
Declaration
public void Delete_NothingToRemove_ReportsTheMissingTarget()
Delete_SafeDeleteReviewTookItOver_ReportsAPendingRemovalInsteadOfSilence()
Driven through the injected seam, not the real hook: SerenitySafeDeleteAssetProcessor bails out
in batch mode (so a headless run never reaches the branch) and opens a non-modal review window
otherwise (so an interactive run would leave one hanging). What is under test is the decision the
creator makes once the hook has answered, and that decision is exactly this boolean.
Declaration
public void Delete_SafeDeleteReviewTookItOver_ReportsAPendingRemovalInsteadOfSilence()
Delete_UnreferencedAchievement_RemovesItFromTheProject()
Declaration
public void Delete_UnreferencedAchievement_RemovesItFromTheProject()
Duplicate_CopiesEveryAuthoredFieldUnderTheNewId()
Declaration
public void Duplicate_CopiesEveryAuthoredFieldUnderTheNewId()
Duplicate_GivesTheCopyAConditionTreeOfItsOwn()
Declaration
public void Duplicate_GivesTheCopyAConditionTreeOfItsOwn()
Duplicate_NothingToCopy_ReportsTheMissingSource()
Declaration
public void Duplicate_NothingToCopy_ReportsTheMissingSource()
OneTimeTearDown()
Every per-test deletion above goes through AssetDatabase.DeleteAsset — and the two tests that remove a folder from disk behind the AssetDatabase's back already repair the cache themselves via Serenity.UnityAchievements.Tests.Editor.AchievementDefinitionCreatorTests.RepairTheAssetDatabaseCacheBeforeTeardown before this teardown runs — so a manual refresh between tests is unnecessary; flushing to disk once after the whole fixture is enough.
Declaration
public void OneTimeTearDown()
SetUp()
Declaration
public void SetUp()
TearDown()
Declaration
public void TearDown()
Update_AppliesEveryFieldInPlaceAndKeepsTheGuid()
Declaration
public void Update_AppliesEveryFieldInPlaceAndKeepsTheGuid()
Update_IsUndoable_RestoringBothTheFieldsAndTheConditionTree()
Scoped to its own undo group and reverted down to it, so the test cannot reach past its own edits
into whatever the editor did before it — which a bare Undo.PerformUndo would.
Declaration
public void Update_IsUndoable_RestoringBothTheFieldsAndTheConditionTree()
Update_KeepingItsOwnId_IsNotReportedAsItsOwnDuplicate()
Declaration
public void Update_KeepingItsOwnId_IsNotReportedAsItsOwnDuplicate()
Update_NothingToEdit_ReportsTheMissingTarget()
Declaration
public void Update_NothingToEdit_ReportsTheMissingTarget()
ValidateIdentity_BlankId_ReturnsError(string)
Declaration
public void ValidateIdentity_BlankId_ReturnsError(string achievementId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | achievementId |
ValidateIdentity_IdAlreadyTakenInTheTargetFolder_ReturnsError()
Declaration
public void ValidateIdentity_IdAlreadyTakenInTheTargetFolder_ReturnsError()
ValidateIdentity_IdTakenInAnotherFolder_WarnsWithoutBlocking()
Declaration
public void ValidateIdentity_IdTakenInAnotherFolder_WarnsWithoutBlocking()
ValidateIdentity_IdThatIsNotASlug_ReturnsError()
Declaration
public void ValidateIdentity_IdThatIsNotASlug_ReturnsError()
Validate_ConditionThatCannotBeEvaluated_ReturnsErrorInTheConditionSection()
Declaration
public void Validate_ConditionThatCannotBeEvaluated_ReturnsErrorInTheConditionSection()
Validate_FolderOutsideAssets_ReturnsError()
Declaration
public void Validate_FolderOutsideAssets_ReturnsError()
Validate_ForeignAssetAtTheTargetPath_ReportsOnlyTheOccupiedPath()
An achievement sharing a folder with another one that carries its Id trips BOTH identity rules at once, which hides whether either works. This isolates the path rule: a foreign asset sits at the target path, and no achievement anywhere claims the Id.
Declaration
public void Validate_ForeignAssetAtTheTargetPath_ReportsOnlyTheOccupiedPath()
Validate_HiddenWithoutADescription_IsAWarning()
Declaration
public void Validate_HiddenWithoutADescription_IsAWarning()
Validate_IdTakenByADifferentlyNamedFileInTheFolder_ReportsOnlyTheDuplicateId()
The mirror of the test above: the Id is taken in this folder by an achievement whose FILE is named something else, so the target path is free and only the duplicate rule may speak.
Declaration
public void Validate_IdTakenByADifferentlyNamedFileInTheFolder_ReportsOnlyTheDuplicateId()
Validate_NegativePoints_ReturnsError()
Declaration
public void Validate_NegativePoints_ReturnsError()
Validate_NegativeProgressTarget_ReturnsError()
Declaration
public void Validate_NegativeProgressTarget_ReturnsError()
Validate_NoConditionAtAll_IsAWarningNotAnError()
Declaration
public void Validate_NoConditionAtAll_IsAWarningNotAnError()
Validate_NoIcon_IsAWarning()
Declaration
public void Validate_NoIcon_IsAWarning()
Validate_TargetPathAlreadyOccupied_ReturnsError()
Declaration
public void Validate_TargetPathAlreadyOccupied_ReturnsError()