public async Task Should_get_state_from_all_actors() { sut.Connect(); A.CallTo(() => actor1.GetState()) .Returns(new EventConsumerInfo { Name = consumerName1, Position = "123 " }); A.CallTo(() => actor2.GetState()) .Returns(new EventConsumerInfo { Name = consumerName2, Position = "345 " }); var response = await pubSub.RequestAsync <GetStatesRequest, GetStatesResponse>(new GetStatesRequest(), TimeSpan.FromSeconds(5), true); response.States.ShouldAllBeEquivalentTo(new EventConsumerInfo[] { new EventConsumerInfo { Name = consumerName1, Position = "123 " }, new EventConsumerInfo { Name = consumerName2, Position = "345 " } }); }
public async Task <IActionResult> GetEventConsumers() { var entities = await pubSub.RequestAsync <GetStatesRequest, GetStatesResponse>(new GetStatesRequest(), TimeSpan.FromSeconds(2), true); var models = entities.States.Select(x => SimpleMapper.Map(x, new EventConsumerDto())).ToList(); return(Ok(models)); }