[Fact] public void GetPostById_ShouldContactBlogPostGrain() { var postGrain = new Mock <IBlogPostGrain>(); var post = new BlogPost { BlogPostId = Guid.NewGuid() }; _clusterClient.Setup(c => c.GetGrain <IBlogPostGrain>(post.BlogPostId, null)) .Returns(() => postGrain.Object); postGrain.Setup(g => g.Find()).Returns(() => Task.FromResult(post)); _blogPostService.GetPostById(post.BlogPostId) .Should().Be(post, "because that's what we requested"); _clusterClient.Verify(c => c.GetGrain <IBlogPostGrain>(post.BlogPostId, null), Times.Once(), "because we need to fetch the grain"); postGrain.Verify(g => g.Find(), Times.Once(), "because we need to fetch the post"); _clusterClient.VerifyNoOtherCalls(); postGrain.VerifyNoOtherCalls(); }