/// <summary>
 /// Set the required key in the flow data to "prefix.requiredkey" where
 /// prefix is supplied, and the required key is a constant which exists
 /// in headers, cookies and query parameters.
 ///
 /// Then test that the evidence for the required key (and only the
 /// required key) is added to the flow data evidence collection.
 /// </summary>
 /// <param name="prefix">prefix to test</param>
 private void CheckRequired(string prefix)
 {
     SetRequiredKey(prefix + "." + requiredKey);
     service.AddEvidenceFromRequest(flowData.Object, request.Object);
     flowData.Verify(f => f.AddEvidence(
                         It.IsAny <string>(), It.IsAny <string>()),
                     Times.Once);
     flowData.Verify(f => f.AddEvidence(
                         prefix + "." + requiredKey, expectedValue),
                     Times.Once);
 }
Example #2
0
        public void WebRequestEvidenceService_IpNull()
        {
            SetRequiredKey(Core.Constants.EVIDENCE_CLIENTIP_KEY);
            _request.SetupGet(r => r.HttpContext.Connection.RemoteIpAddress)
            .Returns((IPAddress)null);

            _service.AddEvidenceFromRequest(_flowData.Object, _request.Object);
            _flowData.Verify(f => f.AddEvidence(
                                 Core.Constants.EVIDENCE_CLIENTIP_KEY, It.IsAny <object>()),
                             Times.Never);
        }