public void IdsErrorConstructorTest4() { string errorMessage = "This is an error message."; IdsError target = new IdsError(errorMessage); Assert.AreEqual(target.Message, errorMessage); }
public void IdsErrorConstructorTest3() { string message = "IdsError was thrown."; IdsError target = new IdsError(); Assert.AreEqual(target.Message, message); }
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"); }
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"); }
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); }
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); }
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); } } } }
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); }