예제 #1
0
        private async Task SubscribeStoriesAsync()
        {
            var stream = _client.StreamStories(new SubscribeStories());

            while (await stream.ResponseStream.MoveNext(CancellationToken.None))
            {
                var story = stream.ResponseStream.Current;
                StoryCreated?.Invoke(new StoryDto
                {
                    Id        = story.Id,
                    Title     = story.Title,
                    CreatedAt = DateTime.Parse(story.CreatedAt),
                    Author    = new AuthorDto
                    {
                        Id   = Guid.Parse(story.Author.Id),
                        Name = story.Author.Name
                    },
                    Tags = story.Tags
                });
            }
        }
예제 #2
0
 public void When(StoryCreated storyCreated)
 {
     StoryId         = storyCreated.StoryId;
     _taskReferences = new List <Guid>();
 }