Пример #1
0
        public async void Server_With_No_Headers_Returns_Failed_Scans()
        {
            var targetResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent("OK")
            };

            SentinelSecurityScanner.InjectMock <IHttpClientWrapper>(x => new MockHttpClientWrapper(targetResponse));

            // Act
            // Actual request.
            var request  = TestFactory.CreateHttpPostRequest(new ScanRequest(Target.FromUri("https://domain.example.com")));
            var response = (JsonResult)await SentinelSecurityScanner.Run(request, _logger);

            // Assert
            var results = response.Value as ScanResults;

            Assert.NotNull(results);
            Assert.False(results.Results.All(x => x.Value.Passed));
        }
Пример #2
0
 public static DefaultHttpRequest CreateHttpPostRequest(ScanRequest request) =>
 TestFactory.CreateHttpPostRequest(JsonSerializer.Serialize(request));