System.Xml.Tests.ExceptionVerifier.IsExceptionOk C# (CSharp) Méthode

IsExceptionOk() public méthode

public IsExceptionOk ( Exception e, object IdsAndParams ) : void
e System.Exception
IdsAndParams object
Résultat void
        public void IsExceptionOk(Exception e, object[] IdsAndParams)
        {
            CheckNull(e);
            _ex = e;

            _actualMessage = e.Message;
            _expectedMessage = ConstructExpectedMessage(IdsAndParams);

            CompareMessages();
        }

Same methods

ExceptionVerifier::IsExceptionOk ( Exception e, string expectedResId ) : void
ExceptionVerifier::IsExceptionOk ( Exception e, string expectedResId, string paramValues ) : void
ExceptionVerifier::IsExceptionOk ( Exception e, string expectedResId, string paramValues, LineInfo lineInfo ) : void

Usage Example

        public void InitializeWithElementValidate_OtherElement_Type_Attribute(String typeToValidate)
        {
            XmlSchemaValidator val;
            XmlSchemaInfo      info    = new XmlSchemaInfo();
            XmlSchemaSet       schemas = new XmlSchemaSet();

            schemas.Add("", Path.Combine(TestData, XSDFILE_PARTIAL_VALIDATION));
            schemas.Compile();

            val = CreateValidator(schemas);
            val.Initialize(schemas.GlobalElements[new XmlQualifiedName("PartialElement")]);

            try
            {
                switch (typeToValidate)
                {
                case "other":
                    val.ValidateElement("PartialElement2", "", info);
                    break;

                case "type":
                    val.ValidateElement("foo", "", info, "PartialType", null, null, null);
                    break;

                case "attribute":
                    val.ValidateAttribute("PartialAttribute", "", StringGetter("123"), info);
                    break;

                default:
                    Assert.True(false);
                    break;
                }
            }
            catch (XmlSchemaValidationException e)
            {
                switch (typeToValidate)
                {
                case "other":
                    _exVerifier.IsExceptionOk(e, "Sch_SchemaElementNameMismatch", new string[] { "PartialElement2", "PartialElement" });
                    break;

                case "type":
                    _exVerifier.IsExceptionOk(e, "Sch_SchemaElementNameMismatch", new string[] { "foo", "PartialElement" });
                    break;

                case "attribute":
                    _exVerifier.IsExceptionOk(e, "Sch_ValidateAttributeInvalidCall");
                    break;

                default:
                    Assert.True(false);
                    break;
                }
                return;
            }

            Assert.True(false);
        }
All Usage Examples Of System.Xml.Tests.ExceptionVerifier::IsExceptionOk