예제 #1
0
        public void When_request_has_sensitive_property_then_it_is_masked_for_content_logging()
        {
            var request = new MyRequest
            {
                RequestProperty = "hej"
            };

            var result = request.GetRequestContentForLogging(JsonConvert.SerializeObject(request));

            const string expected = @"{
  ""RequestProperty"": ""HEJ"",
  ""Context"": null
}";

            Assert.AreEqual(expected, result);
        }
예제 #2
0
        public void When_request_has_sensitive_property_then_it_is_masked_for_content_logging()
        {
            var request = new MyRequest
            {
                SensitiveRequestString     = "secret",
                SensitiveRequestInteger    = 123456789,
                NonSensitiveRequestString  = "info",
                NonSensitiveRequestInteger = 123456789
            };

            var result = request.GetRequestContentForLogging(JsonConvert.SerializeObject(request));

            const string expected = @"{
  ""SensitiveRequestString"": ""***"",
  ""SensitiveRequestInteger"": ""*****6789"",
  ""NonSensitiveRequestString"": ""info"",
  ""NonSensitiveRequestInteger"": 123456789,
  ""Context"": null
}";

            Assert.AreEqual(expected, result);
        }