logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class FailableAchievementStore

    Decorates an IAchievementStore so a test can make it fail on demand — the way a remote backend fails: by throwing, not by returning a flag.

    Inheritance
    object
    FailableAchievementStore
    Implements
    IAchievementStore
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Tests.Fakes
    Assembly: Tests.dll
    Syntax
    public class FailableAchievementStore : IAchievementStore
    Remarks

    A decorator rather than a standalone throwing fake, so a test can fail one call and still assert on what the real in-memory store holds afterwards.

    Constructors

    FailableAchievementStore(IAchievementStore)

    Wraps a store that works, so failures can be switched on around it.

    Declaration
    public FailableAchievementStore(IAchievementStore inner)
    Parameters
    Type Name Description
    IAchievementStore inner

    The store every call is forwarded to while no failure is armed.

    Properties

    AlwaysFail

    When set, every call throws until it is cleared.

    Declaration
    public bool AlwaysFail { get; set; }
    Property Value
    Type Description
    bool

    FailNextCall

    When set, the next call throws and the flag clears itself.

    Declaration
    public bool FailNextCall { get; set; }
    Property Value
    Type Description
    bool

    FailOnlyOperationsContaining

    When set, only calls whose name contains this text fail. Null fails every call.

    Declaration
    public string FailOnlyOperationsContaining { get; set; }
    Property Value
    Type Description
    string

    FailedCallCount

    How many calls were made to throw.

    Declaration
    public int FailedCallCount { get; }
    Property Value
    Type Description
    int

    Methods

    ClearAsync(PlayerId, CancellationToken)

    Declaration
    public Task ClearAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    EnsureSchemaAsync(CancellationToken)

    Declaration
    public Task EnsureSchemaAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    GetProgressAsync(PlayerId, CancellationToken)

    Declaration
    public Task<IReadOnlyList<AchievementProgress>> GetProgressAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<AchievementProgress>>

    GetUnlocksAsync(PlayerId, CancellationToken)

    Declaration
    public Task<IReadOnlyList<AchievementUnlockRecord>> GetUnlocksAsync(PlayerId player, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IReadOnlyList<AchievementUnlockRecord>>

    HealthCheckAsync(CancellationToken)

    Declaration
    public Task<bool> HealthCheckAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>

    UpsertProgressAsync(PlayerId, AchievementProgress, CancellationToken)

    Declaration
    public Task UpsertProgressAsync(PlayerId player, AchievementProgress progress, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    PlayerId player
    AchievementProgress progress
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    UpsertUnlockAsync(AchievementUnlockRecord, CancellationToken)

    Declaration
    public Task UpsertUnlockAsync(AchievementUnlockRecord record, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    AchievementUnlockRecord record
    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    Implements

    IAchievementStore
    In this article
    © 2026 Serenity. All Rights Reserved