|
1 |
| -// ------------------------------------------------------------------------ |
| 1 | +// ------------------------------------------------------------------------ |
2 | 2 | // Copyright 2021 The Dapr Authors
|
3 | 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | // you may not use this file except in compliance with the License.
|
@@ -119,5 +119,41 @@ public void SetActorProxyFactoryDefaultOptions_ToNull_ThrowsArgumentNullExceptio
|
119 | 119 |
|
120 | 120 | action.Should().Throw<ArgumentNullException>();
|
121 | 121 | }
|
| 122 | + |
| 123 | + public interface INonActor |
| 124 | + { |
| 125 | + } |
| 126 | + |
| 127 | + [Fact] |
| 128 | + public void CreateActorProxyForNonActorInterfaces() |
| 129 | + { |
| 130 | + var factory = new ActorProxyFactory(); |
| 131 | + |
| 132 | + var actorId = new ActorId("abc"); |
| 133 | + |
| 134 | + Assert.Throws<ArgumentException>(() => factory.CreateActorProxy(actorId, typeof(INonActor), "NonActor")); |
| 135 | + } |
| 136 | + |
| 137 | + internal interface IInternalActor : IActor |
| 138 | + { |
| 139 | + } |
| 140 | + |
| 141 | + internal interface IInternalActor2 : IInternalActor |
| 142 | + { |
| 143 | + } |
| 144 | + |
| 145 | + [Fact] |
| 146 | + public void CreateActorProxyForNonPublicActorInterfaces() |
| 147 | + { |
| 148 | + var factory = new ActorProxyFactory(); |
| 149 | + |
| 150 | + var actorId = new ActorId("abc"); |
| 151 | + |
| 152 | + Assert.Throws<ArgumentException>(() => factory.CreateActorProxy<IInternalActor>(actorId, "InternalActor")); |
| 153 | + Assert.Throws<ArgumentException>(() => factory.CreateActorProxy<IInternalActor2>(actorId, "InternalActor2")); |
| 154 | + |
| 155 | + Assert.Throws<ArgumentException>(() => factory.CreateActorProxy(actorId, typeof(IInternalActor), "InternalActor")); |
| 156 | + Assert.Throws<ArgumentException>(() => factory.CreateActorProxy(actorId, typeof(IInternalActor2), "InternalActor2")); |
| 157 | + } |
122 | 158 | }
|
123 | 159 | }
|
0 commit comments