Example #1
0
        public void MaskLastSymbols()
        {
            var xml =
                @"<soap:Envelope
xmlns:soap=""http://www.w3.org/2003/05/soap-envelope/""
soap:encodingStyle=""http://www.w3.org/2003/05/soap-encoding"">

  <soap:Body xmlns:m=""http://www.example.org/stock"">
      <m:GetStockPriceResponse>
        <m:Price>12345678</m:Price>
		     <m:Price2>12345678</m:Price2>
    </m:GetStockPriceResponse>
  </soap:Body>

</soap:Envelope>";

            var maskedXml = _masker.MaskByElementName(xml, "Price2", MaskingStrategies.LastSymbolsByPercent(25));

            Assert.Equal(
                @"<soap:Envelope
xmlns:soap=""http://www.w3.org/2003/05/soap-envelope/""
soap:encodingStyle=""http://www.w3.org/2003/05/soap-encoding"">

  <soap:Body xmlns:m=""http://www.example.org/stock"">
      <m:GetStockPriceResponse>
        <m:Price>12345678</m:Price>
		     <m:Price2>12******</m:Price2>
    </m:GetStockPriceResponse>
  </soap:Body>

</soap:Envelope>", maskedXml);
        }
Example #2
0
        public void MaskLastSymbols()
        {
            var json =
                @"{
   ""code"":  ""code"",
  ""test"": ""test"",
}";

            var maskedJson = _masker.Mask(json, p => p.Name == "code", MaskingStrategies.LastSymbolsByPercent(25));

            Assert.Equal(
                @"{
   ""code"":  ""c***"",
  ""test"": ""test"",
}", maskedJson);
        }