public async Task CreateActorsWithActorService() { _fabricRuntime = new MockFabricRuntime("Overlord"); _fabricRuntime.SetupActor <ActorDemo, ActorDemoActorService>( (service, actorId) => new ActorDemo(service, actorId), (context, actorTypeInformation, stateProvider, stateManagerFactory) => new ActorDemoActorService(context, actorTypeInformation, stateProvider: stateProvider)); await ExecutionHelper.ExecuteWithRetriesAsync((ct) => { var actor = _fabricRuntime.ActorProxyFactory.CreateActorProxy <IActorDemo>(new ActorId("first")); return(actor.SetCountAsync(1)); }, 3, TimeSpan.FromMilliseconds(3), CancellationToken.None); await ExecutionHelper.ExecuteWithRetriesAsync((ct) => { var actor = _fabricRuntime.ActorProxyFactory.CreateActorProxy <IActorDemo>(new ActorId("second")); return(actor.SetCountAsync(2)); }, 3, TimeSpan.FromMilliseconds(3), CancellationToken.None); await ExecutionHelper.ExecuteWithRetriesAsync((ct) => { var actor = _fabricRuntime.ActorProxyFactory.CreateActorProxy <IActorDemo>(new ActorId("third")); return(actor.SetCountAsync(3)); }, 3, TimeSpan.FromMilliseconds(3), CancellationToken.None); _proxy = _fabricRuntime.ActorProxyFactory.CreateActorServiceProxy <IActorDemoActorService>( _fabricRuntime.ApplicationUriBuilder.Build("ActorDemoActorService").ToUri(), new ActorId("testivus")); }
public async Task MockActorProxy_should_should_be_able_to_create_proxy_for_specific_ActorService() { var fabricRuntime = new MockFabricRuntime("Overlord"); fabricRuntime.SetupActor <ActorDemo, ActorDemoActorService>( (service, actorId) => new ActorDemo(service, actorId), (context, actorTypeInformation, stateProvider, stateManagerFactory) => new ActorDemoActorService(context, actorTypeInformation)); IActorDemoActorService proxy = null; await ExecutionHelper.ExecuteWithRetriesAsync((ct) => { proxy = fabricRuntime.ActorProxyFactory.CreateActorServiceProxy <IActorDemoActorService>( fabricRuntime.ApplicationUriBuilder.Build("ActorDemoActorService").ToUri(), new ActorId("testivus")); return(Task.FromResult(true)); }, 3, TimeSpan.FromMilliseconds(3), CancellationToken.None); proxy.Should().NotBeNull(); }