public void ErrorsWithSameErrorMessageAndExceptionAreEqual()
		{
			ApplicationException ex = new ApplicationException();
			RegisteredXmlSchemaError lhs = new RegisteredXmlSchemaError("message", ex);
			RegisteredXmlSchemaError rhs = new RegisteredXmlSchemaError("message", ex);
			Assert.IsTrue(lhs.Equals(rhs));
		}
 public void SchemaWithNoNamespaceRecordedAsError()
 {
     string message = "Ignoring schema with no namespace '" + testSchemaFileName + "'.";
     RegisteredXmlSchemaError error = new RegisteredXmlSchemaError(message);
     RegisteredXmlSchemaError[] expectedErrors = new RegisteredXmlSchemaError[] { error };
     Assert.AreEqual(expectedErrors, registeredXmlSchemas.GetSchemaErrors());
 }
 public void OneErrorReportedWhenReadingSchemas()
 {
     string message = @"Unable to read schema 'd:\projects\schemas\addin.xsd'.";
     RegisteredXmlSchemaError error = new RegisteredXmlSchemaError(message, exceptionThrownWhenReadingSchema);
     RegisteredXmlSchemaError[] expectedErrors = new RegisteredXmlSchemaError[] { error };
     Assert.AreEqual(expectedErrors, registeredXmlSchemas.GetSchemaErrors());
 }
		public void ErrorsWithSameMessageButDifferentExceptionsAreNotEqual()
		{
			ApplicationException firstEx = new ApplicationException();
			ApplicationException secondEx = new ApplicationException();
			RegisteredXmlSchemaError lhs = new RegisteredXmlSchemaError("message", firstEx);
			RegisteredXmlSchemaError rhs = new RegisteredXmlSchemaError("message", secondEx);
			Assert.IsFalse(lhs.Equals(rhs));
		}
Esempio n. 5
0
        public override bool Equals(object obj)
        {
            RegisteredXmlSchemaError rhs = obj as RegisteredXmlSchemaError;

            return((message == rhs.message) && Object.ReferenceEquals(exception, rhs.exception));
        }
		public void ExceptionMessageReturnedInToString()
		{
			ApplicationException ex = new ApplicationException("exception message");
			RegisteredXmlSchemaError error = new RegisteredXmlSchemaError("message", ex);
			Assert.AreEqual("message\r\nexception message", error.ToString());
		}		
		public void HasExceptionReturnsFalseIfErrorHasNoException()
		{
			RegisteredXmlSchemaError error = new RegisteredXmlSchemaError("message");
			Assert.IsFalse(error.HasException);
		}	
		public void HasExceptionReturnsTrueIfErrorHasException()
		{
			ApplicationException ex = new ApplicationException();
			RegisteredXmlSchemaError error = new RegisteredXmlSchemaError("message", ex);
			Assert.IsTrue(error.HasException);
		}
		public void ErrorsWithDifferentMessagesAreNotEqual()
		{
			RegisteredXmlSchemaError lhs = new RegisteredXmlSchemaError("message");
			RegisteredXmlSchemaError rhs = new RegisteredXmlSchemaError("different-message");
			Assert.IsFalse(lhs.Equals(rhs));
		}
		public void ErrorsWithSameErrorMessagesAreEqual()
		{
			RegisteredXmlSchemaError lhs = new RegisteredXmlSchemaError("message");
			RegisteredXmlSchemaError rhs = new RegisteredXmlSchemaError("message");
			Assert.IsTrue(lhs.Equals(rhs));
		}
		public void ExceptionCanBeRetrieved()
		{
			ApplicationException ex = new ApplicationException();
			RegisteredXmlSchemaError error = new RegisteredXmlSchemaError("message", ex);
			Assert.AreSame(ex, error.Exception);
		}
		public void ErrorToStringMatchesMessageProperty()
		{
			RegisteredXmlSchemaError error = new RegisteredXmlSchemaError("message");
			Assert.AreEqual("message", error.ToString());
		}
		public void ErrorMessageCanBeRetrieved()
		{
			RegisteredXmlSchemaError error = new RegisteredXmlSchemaError("message");
			Assert.AreEqual("message", error.Message);
		}