Open jaq316 opened 1 year ago
https://github.com/dapr/dotnet-sdk/blob/3b979e6bdb1d779563f1656fa684183b2bfecd08/test/Dapr.Actors.Test/ITestActor.cs#L47C31-L47C31 implements overriding of the StateManager by providing an optional IStateManager parameter in the constructor. If that is provided, this.StateManager
is set in the constructor.
@jaq316 is this a recommendation to provide an IActorStartManager
parameter in every actor, so it is testable?
That sounds kinda strange because in the real world the Actors doesn't need this injecten
Documentation on writing unit tests, specifically for Actors accessing state would be great.
The below code, for instance, would throw: "InvalidOperationException: The actor was initialized without a state provider, and so cannot interact with state. If this is inside a unit test, replace Actor.StateProvider with a mock."