logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class RecordingScoreService

    IScoreService implementation backed by an in-memory dictionary, recording how often each mutation was called so a test can assert both the resulting value and the fact that the service was (or was not) touched at all.

    Inheritance
    object
    RecordingScoreService
    Implements
    IScoreService
    IService
    IFoundationSettings
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Tests.Shared.Fakes
    Assembly: Tests.dll
    Syntax
    public class RecordingScoreService : IScoreService, IService, IFoundationSettings
    Remarks

    Mirrors the production service's contract that a mutation on an unregistered key is a silent no-op, so a test can deliberately leave a key unregistered.

    Constructors

    RecordingScoreService()

    Declaration
    public RecordingScoreService()

    Properties

    AddCallCount

    How many times Add(ScoreKey, float) was called, including on unregistered keys.

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

    Guid

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

    Id

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

    LogService

    Declaration
    public ILogService LogService { get; set; }
    Property Value
    Type Description
    ILogService

    RegisterCallCount

    How many times Register(ScoreKey, ScoreMetricKind) was called.

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

    TryGetValueCallCount

    How many times TryGetValue(ScoreKey, out ScoreValue) was called.

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

    Methods

    Add(ScoreKey, float)

    Declaration
    public void Add(ScoreKey key, float delta)
    Parameters
    Type Name Description
    ScoreKey key
    float delta

    AmountOf(string)

    The current amount stored under a metric key, or zero when it is not registered.

    Declaration
    public float AmountOf(string key)
    Parameters
    Type Name Description
    string key

    The metric key to read.

    Returns
    Type Description
    float

    Divide(ScoreKey, float)

    Declaration
    public void Divide(ScoreKey key, float divisor)
    Parameters
    Type Name Description
    ScoreKey key
    float divisor

    GetSnapshot()

    Declaration
    public ScoreSnapshot GetSnapshot()
    Returns
    Type Description
    ScoreSnapshot

    Multiply(ScoreKey, float)

    Declaration
    public void Multiply(ScoreKey key, float factor)
    Parameters
    Type Name Description
    ScoreKey key
    float factor

    Register(ScoreKey, ScoreMetricKind)

    Declaration
    public void Register(ScoreKey key, ScoreMetricKind kind)
    Parameters
    Type Name Description
    ScoreKey key
    ScoreMetricKind kind

    ResetAll()

    Declaration
    public void ResetAll()

    ResetKey(ScoreKey)

    Declaration
    public void ResetKey(ScoreKey key)
    Parameters
    Type Name Description
    ScoreKey key

    SaveSnapshot()

    Declaration
    public bool SaveSnapshot()
    Returns
    Type Description
    bool

    Set(ScoreKey, float)

    Declaration
    public void Set(ScoreKey key, float value)
    Parameters
    Type Name Description
    ScoreKey key
    float value

    Subtract(ScoreKey, float)

    Declaration
    public void Subtract(ScoreKey key, float delta)
    Parameters
    Type Name Description
    ScoreKey key
    float delta

    TryGetValue(ScoreKey, out ScoreValue)

    Declaration
    public bool TryGetValue(ScoreKey key, out ScoreValue value)
    Parameters
    Type Name Description
    ScoreKey key
    ScoreValue value
    Returns
    Type Description
    bool

    Implements

    IScoreService
    IService
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved