/// <summary>
 /// Creates a new instance of the <see cref="DropboxApiException"/> class.
 /// </summary>
 /// <param name="info">
 /// The <see cref="System.Runtime.Serialization.SerializationInfo"/>
 /// that holds the serialized object data about the exception being thrown.
 /// </param>
 /// <param name="context">
 /// The <see cref="System.Runtime.Serialization.StreamingContext"/>
 /// that contains contextual information about the source or destination.
 /// </param>
 protected DropboxApiException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if (info != null)
     {
         this.error = (DropboxApiError)info.GetValue("Error", typeof(DropboxApiError));
     }
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new instance of the <see cref="DropboxApiException"/> class.
 /// </summary>
 /// <param name="info">
 /// The <see cref="System.Runtime.Serialization.SerializationInfo"/>
 /// that holds the serialized object data about the exception being thrown.
 /// </param>
 /// <param name="context">
 /// The <see cref="System.Runtime.Serialization.StreamingContext"/>
 /// that contains contextual information about the source or destination.
 /// </param>
 protected DropboxApiException(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     if (info != null)
     {
         this.error = (DropboxApiError)info.GetValue("Error", typeof(DropboxApiError));
     }
 }
 private void AssertDropboxApiException(Exception ex, string expectedMessage, DropboxApiError error)
 {
     if (ex is DropboxApiException)
     {
         Assert.AreEqual(expectedMessage, ex.Message);
         Assert.AreEqual(error, ((DropboxApiException)ex).Error);
     }
     else
     {
         Assert.Fail("DropboxApiException expected");
     }
 }
        public void BinarySerialization()
        {
            string          message = "Error message";
            DropboxApiError error   = DropboxApiError.OperationNotPermitted;

            DropboxApiException exBefore = new DropboxApiException(message, error);

            DropboxApiException exAfter = SerializationTestUtils.BinarySerializeAndDeserialize(exBefore) as DropboxApiException;

            Assert.IsNotNull(exAfter);
            Assert.AreEqual(message, exAfter.Message, "Invalid message");
            Assert.AreEqual(error, exAfter.Error, "Invalid error");
        }
Beispiel #5
0
 /// <summary>
 /// Creates a new instance of the <see cref="DropboxApiException"/> class.
 /// </summary>
 /// <param name="message">A message about the exception.</param>
 /// <param name="innerException">The inner exception that is the cause of the current exception.</param>
 public DropboxApiException(string message, Exception innerException)
     : base(message, innerException)
 {
     this.error = DropboxApiError.Unknown;
 }
Beispiel #6
0
 /// <summary>
 /// Creates a new instance of the <see cref="DropboxApiException"/> class.
 /// </summary>
 /// <param name="message">A message about the exception.</param>
 /// <param name="error">The Dropbox error.</param>
 public DropboxApiException(string message, DropboxApiError error)
     : base(message)
 {
     this.error = error;
 }
        // tests helpers

#if NET_4_0 || SILVERLIGHT_5
        private void AssertDropboxApiException(AggregateException ae, string expectedMessage, DropboxApiError error)
        {
            ae.Handle(ex =>
            {
                if (ex is DropboxApiException)
                {
                    Assert.AreEqual(expectedMessage, ex.Message);
                    Assert.AreEqual(error, ((DropboxApiException)ex).Error);
                    return true;
                }
                return false;
            });
        }
 private void AssertDropboxApiException(Exception ex, string expectedMessage, DropboxApiError error)
 {
     if (ex is DropboxApiException)
     {
         Assert.AreEqual(expectedMessage, ex.Message);
         Assert.AreEqual(error, ((DropboxApiException)ex).Error);
     }
     else
     {
         Assert.Fail("DropboxApiException expected");
     }
 }
 /// <summary>
 /// Creates a new instance of the <see cref="DropboxApiException"/> class.
 /// </summary>
 /// <param name="message">A message about the exception.</param>
 /// <param name="innerException">The inner exception that is the cause of the current exception.</param>
 public DropboxApiException(string message, Exception innerException)
     : base(message, innerException)
 {
     this.error = DropboxApiError.Unknown;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="DropboxApiException"/> class.
 /// </summary>
 /// <param name="message">A message about the exception.</param>
 /// <param name="error">The Dropbox error.</param>
 public DropboxApiException(string message, DropboxApiError error)
     : base(message)
 {
     this.error = error;
 }
        // tests helpers

#if NET_4_0 || SILVERLIGHT_5
        private void AssertDropboxApiException(AggregateException ae, string expectedMessage, DropboxApiError error)
        {
            ae.Handle(ex =>
            {
                if (ex is DropboxApiException)
                {
                    Assert.AreEqual(expectedMessage, ex.Message);
                    Assert.AreEqual(error, ((DropboxApiException)ex).Error);
                    return(true);
                }
                return(false);
            });
        }