コード例 #1
0
        public void IdsErrorConstructorTest4()
        {
            string   errorMessage = "This is an error message.";
            IdsError target       = new IdsError(errorMessage);

            Assert.AreEqual(target.Message, errorMessage);
        }
コード例 #2
0
        public void IdsErrorConstructorTest3()
        {
            string   message = "IdsError was thrown.";
            IdsError target  = new IdsError();

            Assert.AreEqual(target.Message, message);
        }
コード例 #3
0
        public void IdsErrorConstructorTest6()
        {
            string   errorMessage = "This is an error message.";
            IdsError target       = new IdsError(errorMessage);

            target.ErrorCode = "401";
            Assert.AreEqual(target.Message, errorMessage);
            Assert.ReferenceEquals(target.ErrorCode, "401");
        }
コード例 #4
0
        public void IdsErrorConstructorTest5()
        {
            IdsError target = new IdsError("errorMessage", "errorCode", "element", "detail");

            Assert.ReferenceEquals(target.Message, "errorMessage");
            Assert.ReferenceEquals(target.ErrorCode, "errorCode");
            Assert.ReferenceEquals(target.Element, "element");
            Assert.ReferenceEquals(target.Detail, "detail");
        }
コード例 #5
0
        public void IdsErrorConstructorTest1()
        {
            string   errorMessage = "Length exceeds limit";
            string   errorCode    = "2050";
            string   element      = "firstName";
            string   detail       = "Length of the field exceeds 21 chars";
            IdsError target       = new IdsError(errorMessage, errorCode, element, detail);

            Assert.AreEqual(target.Message, errorMessage);
            Assert.AreEqual(target.ErrorCode, errorCode);
            Assert.AreEqual(target.Element, element);
            Assert.AreEqual(target.Detail, detail);
        }
コード例 #6
0
        public void IdsExceptionConstructorTest6()
        {
            string          errorMessage    = "This is an error message.";
            List <IdsError> innerExceptions = new List <IdsError> {
                new IdsError(errorMessage)
            };
            IdsException target = new IdsException(errorMessage, innerExceptions);

            IdsError idsError = innerExceptions[0];

            Assert.AreEqual(target.Message, errorMessage);
            Assert.ReferenceEquals(target.InnerExceptions, innerExceptions);
        }
コード例 #7
0
 public static void WriteQBExceptonDetailToLog(IdsException iex)
 {
     if (iex != null && iex.InnerException != null)
     {
         System.Collections.ObjectModel.ReadOnlyCollection <IdsError> errorCollection = ((Intuit.Ipp.Exception.IdsException)iex.InnerException).InnerExceptions;
         if (errorCollection != null && errorCollection.Count > 0)
         {
             for (int i = 0; i < errorCollection.Count; i++)
             {
                 IdsError error = errorCollection[i];
                 WriteLog("ErrorCode: " + error.ErrorCode + ", Message: " + error.Message + ", Element: " + error.Element + ", Detail: " + error.Detail);
             }
         }
     }
 }
コード例 #8
0
        public void IdsErrorConstructorTest2()
        {
            string   errorMessage = "Length exceeds limit";
            string   errorCode    = "2050";
            string   element      = "firstName";
            string   detail       = "Length of the field exceeds 21 chars";
            IdsError target       = new IdsError(errorMessage, errorCode, element, detail);
            IdsError newTarget    = null;

            using (Stream s = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(s, target);
                s.Position = 0; // Reset stream position
                newTarget  = (IdsError)formatter.Deserialize(s);
            }

            Assert.IsNotNull(newTarget);
            Assert.AreEqual(newTarget.Message, errorMessage);
            Assert.AreEqual(newTarget.ErrorCode, errorCode);
            Assert.AreEqual(newTarget.Element, element);
            Assert.AreEqual(newTarget.Detail, detail);
        }