Class RecordingAchievementService
An IAchievementService that records what was asked of it and answers from a
dictionary, so a suite can assert exactly how many writes an evaluation produced.
Inheritance
RecordingAchievementService
Assembly: Tests.dll
Syntax
public class RecordingAchievementService : IAchievementService, IService, IFoundationSettings, IDisposable
Constructors
RecordingAchievementService(IReadOnlyDictionary<AchievementId, AchievementDefinition>)
Creates a recording service over the given definitions.
Declaration
public RecordingAchievementService(IReadOnlyDictionary<AchievementId, AchievementDefinition> definitions)
Parameters
Properties
Declaration
public bool BlockPlatformSync { get; set; }
Property Value
ConditionStateCalls
Declaration
public List<KeyValuePair<AchievementId, string>> ConditionStateCalls { get; }
Property Value
DisposeCallCount
Declaration
public int DisposeCallCount { get; }
Property Value
FailNextWrite
Makes the next write of every kind fault, the way an unreachable backend would.
Declaration
public bool FailNextWrite { get; set; }
Property Value
Declaration
public bool FailPlatformSync { get; set; }
Property Value
Guid
Declaration
public string Guid { get; set; }
Property Value
Id
Declaration
public string Id { get; set; }
Property Value
IsLoaded
Whether a load has run, as the real service reports it.
Declaration
public bool IsLoaded { get; }
Property Value
LogService
Declaration
public ILogService LogService { get; set; }
Property Value
MaximumPoints
Declaration
public int MaximumPoints { get; set; }
Property Value
ProgressCalls
Declaration
public List<KeyValuePair<AchievementId, long>> ProgressCalls { get; }
Property Value
Declaration
public int RetryPlatformSyncCallCount { get; }
Property Value
TotalPoints
Declaration
public int TotalPoints { get; set; }
Property Value
UnlockCalls
Declaration
public List<AchievementId> UnlockCalls { get; }
Property Value
Methods
Dispose()
Declaration
GetAll()
Declaration
public IReadOnlyList<AchievementDefinition> GetAll()
Returns
GetMaximumPoints()
Declaration
public int GetMaximumPoints()
Returns
GetTotalPoints()
Declaration
public int GetTotalPoints()
Returns
GetUnlocked()
Declaration
public IReadOnlyList<AchievementDefinition> GetUnlocked()
Returns
GetVisible()
Everything not hidden, plus every hidden achievement already unlocked — the real rule.
Declaration
public IReadOnlyList<AchievementDefinition> GetVisible()
Returns
IncrementProgressAsync(AchievementId, long, CancellationToken)
Declaration
public Task IncrementProgressAsync(AchievementId achievement, long delta, CancellationToken cancellationToken = default)
Parameters
Returns
IsUnlocked(AchievementId)
Declaration
public bool IsUnlocked(AchievementId achievement)
Parameters
Returns
LoadAsync(CancellationToken)
Declaration
public Task LoadAsync(CancellationToken cancellationToken = default)
Parameters
Returns
MarkUnlocked(AchievementId)
Marks an achievement as already unlocked, the way a loaded store would.
Declaration
public void MarkUnlocked(AchievementId achievement)
Parameters
| Type |
Name |
Description |
| AchievementId |
achievement |
The achievement to mark.
|
MarkUnlocked(AchievementUnlockRecord)
Marks an achievement as unlocked with a stored record, the way a loaded store would.
Declaration
public void MarkUnlocked(AchievementUnlockRecord record)
Parameters
Declaration
public void ReleasePlatformSync()
ResetAllAsync(CancellationToken)
Declaration
public Task ResetAllAsync(CancellationToken cancellationToken = default)
Parameters
Returns
Declaration
public Task RetryPlatformSyncAsync(CancellationToken cancellationToken = default)
Parameters
Returns
SaveConditionStateAsync(AchievementId, string, CancellationToken)
Declaration
public Task SaveConditionStateAsync(AchievementId achievement, string conditionState, CancellationToken cancellationToken = default)
Parameters
Returns
SeedProgress(AchievementProgress)
Seeds the tracked progress of an achievement, the way a loaded store would.
Declaration
public void SeedProgress(AchievementProgress progress)
Parameters
SetProgressAsync(AchievementId, long, CancellationToken)
Declaration
public Task SetProgressAsync(AchievementId achievement, long current, CancellationToken cancellationToken = default)
Parameters
Returns
TryGetProgress(AchievementId, out AchievementProgress)
Declaration
public bool TryGetProgress(AchievementId achievement, out AchievementProgress progress)
Parameters
Returns
TryGetUnlockRecord(AchievementId, out AchievementUnlockRecord)
Declaration
public bool TryGetUnlockRecord(AchievementId achievement, out AchievementUnlockRecord record)
Parameters
Returns
UnlockAsync(AchievementId, CancellationToken)
Declaration
public Task UnlockAsync(AchievementId achievement, CancellationToken cancellationToken = default)
Parameters
Returns
Events
Loaded
Declaration
public event Action Loaded
Event Type
StateReset
Declaration
public event Action StateReset
Event Type
Implements