コード例 #1
0
        public void GetAnalyzedRecipeInstructions()
        {
            var httpClient       = new HttpClient(_handlerMock.Object);
            var subjectUnderTest = new RecipeRepository(_options, httpClient, _cacheServiceMock.Object);

            var result = subjectUnderTest.GetAnalyzedRecipeInstructions(12, null);

            result.Should().NotBeNull();

            var expectedUri = new Uri("https://serverTest.com/recipes/12/analyzedInstructions?123");

            _handlerMock.Protected().Verify(
                "SendAsync",
                Times.Exactly(2),
                ItExpr.Is <HttpRequestMessage>(req =>
                                               req.Method == HttpMethod.Get &&
                                               req.RequestUri == expectedUri
                                               ),
                ItExpr.IsAny <CancellationToken>()
                );
        }