public void website_should_be_verified_website()
        {
            var mockHttpRequest = new Mock <IHttpRequest>();

            var testModel = new VerifyApiModel {
                WebsiteUrl = "http://foo.com"
            };

            var mockExecuter = new Mock <IExecuter>();

            mockExecuter.Setup(x => x.Post <VerifyOwnershipResult>(testModel))
            .Returns(new ExecuteResult <VerifyOwnershipResult>
            {
                Status = HttpStatusCode.OK,
                Data   = VerifyOwnershipResult.Verified
            });


            mockHttpRequest.Setup(x => x.CreateRequest(ApiResource.Website.VERIFY)).Returns(mockHttpRequest.Object);
            mockHttpRequest.Setup(x => x.Execute()).Returns(mockExecuter.Object);

            var netsparkerClient = new NetsparkerRestClient(mockHttpRequest.Object);

            var result = netsparkerClient.WebSite()
                         .Verify(testModel);

            VerifyOwnershipResult expected = VerifyOwnershipResult.Verified;
            VerifyOwnershipResult actual   = result.Data;

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
 public ExecuteResult <VerifyOwnershipResult> Verify(VerifyApiModel model)
 {
     return(_webRequest.CreateRequest(ApiResource.Website.VERIFY)
            .JsonResponseHandler()
            .Execute()
            .Post <VerifyOwnershipResult>(model));
 }