// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. // ------------------------------------------------------------ namespace Dapr.Actors.Test { using System; using System.Threading; using System.Threading.Tasks; using Dapr.Actors.Runtime; /// /// Interface for test actor. /// public interface ITestActor : IActor { /// /// GetCount method for TestActor. /// /// Cancellation token to cancel the operation. /// The current count as stored in actor. Task GetCountAsync(CancellationToken cancellationToken); /// /// SetCount method for test actor. /// /// Count to set for the actor. /// Cancellation token to cancel the operation. /// Task. Task SetCountAsync(int count, CancellationToken cancellationToken); } /// /// Test Actor Class. /// internal class TestActor : Actor, ITestActor { public TestActor(ActorHost host, IActorStateManager stateManager = null, IDaprInteractor daprInteractor = null) : base(host) { if (stateManager != null) { this.StateManager = stateManager; } if(daprInteractor != null) { this.DaprInteractor = daprInteractor; } } /// public Task GetCountAsync(CancellationToken cancellationToken) { return Task.FromResult(5); } /// public Task SetCountAsync(int count, CancellationToken cancellationToken) { return Task.CompletedTask; } public Task SaveTestState() { return this.SaveStateAsync(); } public Task ResetTestStateAsync() { return this.ResetStateAsync(); } public void TimerCallbackNonTaskReturnType() { } public Task TimerCallbackTwoArguments(int i, int j) { Console.WriteLine(i + j); return default; } private Task TimerCallbackPrivate() { return default; } protected Task TimerCallbackProtected() { return default; } internal Task TimerCallbackInternal() { return default; } public Task TimerCallbackPublicWithNoArguments() { return default; } public Task TimerCallbackPublicWithOneArgument(int i) { return default; } public Task TimerCallbackOverloaded() { return default; } public Task TimerCallbackOverloaded(int i) { return default; } public static Task TimerCallbackStatic() { return default; } } }