public void then_flattenned_correctly(object input, string expected) { Act(input); var actual = LogCastDocument.ToJson(Request.Route.SerializedValues); actual.Should().Be(expected); }
public void then_contract_serialized_is_as_expected() { var actualSerialized = LogCastDocument.ToJson(Request.Route); var expected = LogCastDocument.ToJson(new { template = "", controller = (string)null, action = (string)null, values = new {key = "value"} }); actualSerialized.Should().Be(expected); }
public static string RemoveSensitiveData(string body) { if (string.IsNullOrWhiteSpace(body)) { return(null); } if (SensitiveInformationKeywords.All(x => body.IndexOf(x, StringComparison.OrdinalIgnoreCase) == -1)) { return(body); } try { var jsonBody = JObject.Parse(body); if (jsonBody == null) { return(Property.Values.Removed); } var keys = ((IDictionary <string, JToken>)jsonBody) .Where(x => SensitiveInformationKeywords.Contains(x.Key, StringComparer.OrdinalIgnoreCase)) .Select(x => x.Key); foreach (var keyValuePair in keys) { jsonBody[keyValuePair] = Property.Values.Removed; } return(LogCastDocument.ToJson(jsonBody)); } catch (Exception) { return(Property.Values.Removed); } }
private static string Json(object obj) { return(LogCastDocument.ToJson(obj)); }