コード例 #1
0
        public void ScanAsUser(
            [Frozen] Mock <IHttpClient> httpClientMock,
            [Greedy] SpiderComponent sut,
            string url,
            int contextId,
            int userId,
            int maxChildren,
            int scanId)
        {
            // ARRANGE
            var json = new JObject(
                new JProperty("scanAsUser", scanId));

            httpClientMock.SetupApiCall(sut, CallType.Action, "scanAsUser",
                                        new Parameters
            {
                { "url", url },
                { "contextId", contextId },
                { "userId", userId },
                { "maxChildren", maxChildren }
            })
            .Returns(json.ToString())
            .Verifiable();

            // ACT
            var result = sut.ScanAsUser(url, contextId, userId, maxChildren);

            // ASSERT
            result.Should().Be(scanId);
            httpClientMock.Verify();
        }