public void Setup() { _serializer = new XmlSerializer <RedactTestClassForXmlAttributeContainer>(); _container = new RedactTestClassForXmlAttributeContainer(); _testClass = new RedactTestClassForXmlAttribute(); _container.Data = _testClass; }
public void Setup() { _serializer = new XmlSerializer<RedactTestClassForXmlAttributeContainer>(); _container = new RedactTestClassForXmlAttributeContainer(); _testClass = new RedactTestClassForXmlAttribute(); _container.Data = _testClass; }
public void RedactingDoesNotHappenWhenDisabled() { var container = new RedactTestClassForXmlAttributeContainer { Data = new RedactTestClassForXmlAttribute { BoolAttributeProperty = true, DateTimeAttributeProperty = new DateTime(2222, 2, 22, 22, 22, 22, 222, DateTimeKind.Utc), DoubleAttributeProperty = 123.45, EnumAttributeProperty = RedactEnumForXmlAttribute.Second, IntAttributeProperty = 12345, NullableBoolAttributeProperty = false, NullableDateTimeAttributeProperty = new DateTime(3333, 3, 30, 3, 33, 33, 333, DateTimeKind.Utc), NullableDoubleAttributeProperty = 987.65, NullableEnumAttributeProperty = RedactEnumForXmlAttribute.Third, NullableIntAttributeProperty = 98765, StringAttributeProperty = "abc123" } }; var serializer = new XmlSerializer <RedactTestClassForXmlAttributeContainer>(options => options.DisableRedact()); var xml = serializer.Serialize(container); Assert.That(xml, Contains.Substring("true")); Assert.That(xml, Contains.Substring("2222-02-22T22:22:22.2220000Z")); Assert.That(xml, Contains.Substring("123.45")); Assert.That(xml, Contains.Substring("Second")); Assert.That(xml, Contains.Substring("12345")); Assert.That(xml, Contains.Substring("false")); Assert.That(xml, Contains.Substring("3333-03-30T03:33:33.3330000Z")); Assert.That(xml, Contains.Substring("987.65")); Assert.That(xml, Contains.Substring("Third")); Assert.That(xml, Contains.Substring("98765")); Assert.That(xml, Contains.Substring("abc123")); }
public void RedactingDoesNotHappenWhenDisabled() { var container = new RedactTestClassForXmlAttributeContainer { Data = new RedactTestClassForXmlAttribute { BoolAttributeProperty = true, DateTimeAttributeProperty = new DateTime(2222, 2, 22, 22, 22, 22, 222, DateTimeKind.Utc), DoubleAttributeProperty = 123.45, EnumAttributeProperty = RedactEnumForXmlAttribute.Second, IntAttributeProperty = 12345, NullableBoolAttributeProperty = false, NullableDateTimeAttributeProperty = new DateTime(3333, 3, 30, 3, 33, 33, 333, DateTimeKind.Utc), NullableDoubleAttributeProperty = 987.65, NullableEnumAttributeProperty = RedactEnumForXmlAttribute.Third, NullableIntAttributeProperty = 98765, StringAttributeProperty = "abc123" } }; var serializer = new XmlSerializer<RedactTestClassForXmlAttributeContainer>(options => options.DisableRedact()); var xml = serializer.Serialize(container); Assert.That(xml, Contains.Substring("true")); Assert.That(xml, Contains.Substring("2222-02-22T22:22:22.2220000Z")); Assert.That(xml, Contains.Substring("123.45")); Assert.That(xml, Contains.Substring("Second")); Assert.That(xml, Contains.Substring("12345")); Assert.That(xml, Contains.Substring("false")); Assert.That(xml, Contains.Substring("3333-03-30T03:33:33.3330000Z")); Assert.That(xml, Contains.Substring("987.65")); Assert.That(xml, Contains.Substring("Third")); Assert.That(xml, Contains.Substring("98765")); Assert.That(xml, Contains.Substring("abc123")); }