Braintree.Tests.ValidationErrorsTest.Constructor_ParsesValidationErrorOnNestedObject C# (CSharp) Метод

Constructor_ParsesValidationErrorOnNestedObject() приватный Метод

private Constructor_ParsesValidationErrorOnNestedObject ( ) : void
Результат void
        public void Constructor_ParsesValidationErrorOnNestedObject()
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            builder.Append("<api-error-response>");
            builder.Append("  <errors>");
            builder.Append("    <errors type=\"array\"/>");
            builder.Append("    <credit-card>");
            builder.Append("      <billing-address>");
            builder.Append("        <errors type=\"array\">");
            builder.Append("          <error>");
            builder.Append("            <code>91803</code>");
            builder.Append("            <message>Country name is not an accepted country.</message>");
            builder.Append("            <attribute type=\"symbol\">country_name</attribute>");
            builder.Append("          </error>");
            builder.Append("        </errors>");
            builder.Append("      </billing-address>");
            builder.Append("      <errors type=\"array\"/>");
            builder.Append("    </credit-card>");
            builder.Append("  </errors>");
            builder.Append("</api-error-response>");

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(builder.ToString());
            ValidationErrors errors = new ValidationErrors(new NodeWrapper(doc.ChildNodes[1]));
            Assert.AreEqual(1, errors.DeepCount);
            Assert.AreEqual(ValidationErrorCode.ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED, errors.ForObject("credit-card").ForObject("billing-address").OnField("country_name")[0].Code);
        }