File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ private static ActorReference GetActorReference(object actor)
8888 ActorType = actorBase . Host . ActorTypeInfo . ActorTypeName ,
8989 } ,
9090 // Handle case when we can't cast to IActorProxy or Actor.
91- _ => throw new ArgumentOutOfRangeException ( "actor" ) ,
91+ _ => throw new ArgumentOutOfRangeException ( "actor" , "Invalid actor object type." ) ,
9292 } ;
9393
9494 return actorReference ;
Original file line number Diff line number Diff line change 1- using System . Threading . Tasks ;
1+ using System ;
2+ using System . Threading . Tasks ;
23using Dapr . Actors . Client ;
34using Dapr . Actors . Runtime ;
45using Dapr . Actors . Test ;
@@ -56,6 +57,20 @@ public async Task Get_FromActorImplementation_ReturnsActorReference()
5657 Assert . Equal ( expectedActorType , actorReference . ActorType ) ;
5758 }
5859
60+ [ Fact ]
61+ public void Get_WithInvalidObjectType_ThrowArgumentOutOfRangeException ( )
62+ {
63+ // Arrange
64+ var actor = new object ( ) ;
65+
66+ // Act
67+ var act = ( ) => ActorReference . Get ( actor ) ;
68+
69+ // Assert
70+ var exception = Assert . Throws < ArgumentOutOfRangeException > ( act ) ;
71+ Assert . Equal ( "actor" , exception . ParamName ) ;
72+ Assert . Equal ( "Invalid actor object type. (Parameter 'actor')" , exception . Message ) ;
73+ }
5974 }
6075
6176 public interface IActorReferenceTestActor : IActor
You can’t perform that action at this time.
0 commit comments