public async Task TestActorRemotingAsync() { var service = new CustomActorService(MockStatefulServiceContextFactory.Default, ActorTypeInformation.Get(typeof(MyStatefulActor))); var factory = new MockActorServiceRemotingClientFactory(service); var proxyFactory = new ActorProxyFactory(callbackClient => factory); var proxy = proxyFactory.CreateActorProxy <IMyStatefulActor>(ActorId.CreateRandom(), "App", "Service", "Listener"); await proxy.InsertAsync("state", new Payload("content")); Assert.IsInstanceOfType(proxy, typeof(IMyStatefulActor)); }
public async Task TestRemotingFactoryAsync() { var service = new CustomActorService(MockStatefulServiceContextFactory.Default, ActorTypeInformation.Get(typeof(MyStatefulActor))); var factory = new MockActorServiceRemotingClientFactory(service); var client = await factory.GetClientAsync(new Uri("fabric:/App/Service"), ServicePartitionKey.Singleton, TargetReplicaSelector.Default, "Listener", new OperationRetrySettings(), CancellationToken.None); Assert.IsInstanceOfType(factory, typeof(IServiceRemotingClientFactory)); Assert.IsInstanceOfType(client, typeof(IServiceRemotingClient)); Assert.IsInstanceOfType(client, typeof(MockActorServiceRemotingClient)); Assert.AreEqual("Listener", client.ListenerName); }
public async Task Alternative_TestSubscribe_Doesnt_CrashAsync() { var guid = Guid.NewGuid(); var service = new CustomActorService(MockStatefulServiceContextFactory.Default, ActorTypeInformation.Get(typeof(MyStatefulActor))); var factory = new MockActorServiceRemotingClientFactory(service); var mockProxyFactory = new ActorProxyFactory(callbackClient => factory); var exampleService = new ExampleClient(MockStatefulServiceContextFactory.Default, new MockReliableStateManager(), null, mockProxyFactory); await exampleService.DoSomething(guid, "message text"); Assert.IsFalse(IsSuccess); //Subscribe doesn't crash the test, but the Event is not really fired and processed at this time }