Class FakeAchievementScreenshotCapturer
Scriptable IAchievementScreenshotCapturer used for tests: hands back a fixed byte payload, null to exercise the capture-failed path, or — when held — a capture that stays pending until the test releases it, which is what makes the "reset while a capture is in flight" window reachable.
Implements
Inherited Members
Namespace: Serenity.Achievements.Tests.Fakes
Assembly: Tests.dll
Syntax
public class FakeAchievementScreenshotCapturer : IAchievementScreenshotCapturer
Constructors
FakeAchievementScreenshotCapturer()
Declaration
public FakeAchievementScreenshotCapturer()
Properties
CaptureCallCount
How many capture attempts the capturer saw.
Declaration
public int CaptureCallCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Enabled
Whether the capturer reports itself usable.
Declaration
public bool Enabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsEnabled
Declaration
public bool IsEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LastCancellationToken
The token the most recent TryCaptureAsync(CancellationToken) call was given, so a test can prove a disposal reached a capture already in flight without the fake having to honor cancellation itself.
Declaration
public CancellationToken? LastCancellationToken { get; }
Property Value
| Type | Description |
|---|---|
| CancellationToken? |
Payload
The bytes handed back by TryCaptureAsync(CancellationToken). Null means capture failed.
Declaration
public byte[] Payload { get; set; }
Property Value
| Type | Description |
|---|---|
| byte[] |
Methods
HoldNextCapture()
Makes the next capture stay pending until ReleaseHeldCapture() is called.
Declaration
public void HoldNextCapture()
ReleaseHeldCapture()
Completes a held capture with Payload.
Declaration
public void ReleaseHeldCapture()
TryCaptureAsync(CancellationToken)
Declaration
public Task<byte[]> TryCaptureAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<byte[]> |