public async Task TestSubscribe_Doesnt_CrashAsync() { //var service = new CustomActorService(MockStatefulServiceContextFactory.Default, ActorTypeInformation.Get(typeof(MyStatefulActor))); //var factory = new MockActorServiceRemotingClientFactory(service); //var proxyFactory = new ActorProxyFactory(callbackClient => factory) var guid = Guid.NewGuid(); var id = new ActorId(guid); Func <ActorService, ActorId, ActorBase> factory = (service, actorId) => new ExampleActorMock(service, actorId); var svc = MockActorServiceFactory.CreateActorServiceForActor <ExampleActorMock>(factory); var actor = svc.Activate(id); var mockProxyFactory = new MockActorProxyFactory(); mockProxyFactory.RegisterActor(actor); var eventSubscriptionHelper = new MockActorEventSubscriptionHelper(); var exampleService = new ExampleClient(MockStatefulServiceContextFactory.Default, new MockReliableStateManager(), eventSubscriptionHelper, mockProxyFactory); await exampleService.DoSomething(guid, "message text"); Assert.IsTrue(eventSubscriptionHelper.IsSubscribed <IExampleEvents>(exampleService)); Assert.IsFalse(IsSuccess); //Subscribe doesn't crash the test, but the Event is not really fired and processed at this time }
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 }