Ejemplo n.º 1
0
 public static void ValidateErrReportStack(ErrReport err, List <string> msgs)
 {
     msgs.ForEach(
         item => Assert.IsTrue(err.StackTrace.Contains(item.ToString()), String.Format("ErrReport in Stack Does not contain:{0}", item.ToString())));
 }
Ejemplo n.º 2
0
 public static void ErrToConsole(ErrReport e)
 {
     //Console.WriteLine("{0} {1}.{2} : {3}{4}{5}", e.Code, e.AtClass, e.AtMethod, e.Msg, Environment.NewLine, e.StackTrace);
     System.Diagnostics.Trace.WriteLine(String.Format("{0} {1}.{2} : {3}{4}{5}", e.Code, e.AtClass, e.AtMethod, e.Msg, Environment.NewLine, e.StackTrace));
 }
Ejemplo n.º 3
0
 public static void ValidateErrReportStack(ErrReport err, params string[] msgs)
 {
     ValidateErrReportStack(err, msgs.ToList());
 }
Ejemplo n.º 4
0
 public static void ValidateErrReport(ErrReport err, int code, string atClass, string atMethod, string msg, params string[] stackText)
 {
     ValidateErrReport(err, code, atClass, atMethod, msg, stackText.ToList());
 }
Ejemplo n.º 5
0
 public static void ValidateErrReport(ErrReport err, int code, string atClass, string atMethod, string msg)
 {
     ValidateErrReport(err, code, atClass, atMethod, msg, new List <string>());
 }
Ejemplo n.º 6
0
 /// <summary>Constructor</summary>
 /// <param name="report">The Report with the info for location of error</param>
 public ErrReportExceptionFromChk(ErrReport report)
     : base(report)
 {
 }
Ejemplo n.º 7
0
        //[Test]
        //public void ExceptionType_Regular_Param() {
        //    CheckExceptionType(ExceptionType.Regular, () => { WrapErr.ChkParam(null, "zork", 8888); });
        //}

        //[Test]
        //public void ExceptionType_Regular_Var() {
        //    CheckExceptionType(ExceptionType.Regular, () => { WrapErr.ChkVar(null, 8888, "Bad var"); });
        //}

        //[Test]
        //public void ExceptionType_Regular_True() {
        //    CheckExceptionType(ExceptionType.Regular, () => { WrapErr.ChkTrue(false, 8888, "false"); });
        //}

        //[Test]
        //public void ExceptionType_Regular_False() {
        //    CheckExceptionType(ExceptionType.Regular, () => { WrapErr.ChkTrue(true, 8888, "true"); });
        //}

        //[Test]
        //public void ExceptionType_Regular_String_Null() {
        //    CheckExceptionType(ExceptionType.Regular, () => { WrapErr.ChkStr(1111, 2222, "stringName", null); });
        //}

        //[Test]
        //public void ExceptionType_Regular_String_Empty() {
        //    CheckExceptionType(ExceptionType.Regular, () => { WrapErr.ChkStr(1111, 2222, "stringName", ""); });
        //}


        //[Test]
        //public void ExceptionType_Fault_Param() {
        //    CheckExceptionType(ExceptionType.Fault, () => { WrapErr.ChkParam(ExceptionType.Fault, null, "zork", 8888); });
        //}

        //[Test]
        //public void ExceptionType_Fault_Var() {
        //    CheckExceptionType(ExceptionType.Fault, () => { WrapErr.ChkVar(ExceptionType.Fault, null, 8888, "Bad var"); });
        //}

        //[Test]
        //public void ExceptionType_Fault_True() {
        //    CheckExceptionType(ExceptionType.Fault, () => { WrapErr.ChkTrue(ExceptionType.Fault, false, 8888, "false"); });
        //}

        //[Test]
        //public void ExceptionType_Fault_False() {
        //    CheckExceptionType(ExceptionType.Fault, () => { WrapErr.ChkFalse(ExceptionType.Fault, true, 8888, "true"); });
        //}

        //[Test]
        //public void ExceptionType_Fault_StringNull() {
        //    CheckExceptionType(ExceptionType.Fault, () => { WrapErr.ChkStr(ExceptionType.Fault, 1111, 2222, "stringName", null); });
        //}

        //[Test]
        //public void ExceptionType_Fault_StringEmpty() {
        //    CheckExceptionType(ExceptionType.Fault, () => { WrapErr.ChkStr(ExceptionType.Fault, 1111, 2222, "stringName", ""); });
        //}



        //private void CheckExceptionType(ExceptionType type, Action action) {
        //    try {
        //        action.Invoke();
        //    }
        //    catch (ErrReportException e) {
        //        if (type == ExceptionType.Regular) {
        //            return;
        //        }
        //        Assert.Fail("Got and exption type {0} while expecting ", e.GetType().Name, type.ToString());
        //    }
        //    catch (FaultException<ErrReport> e) {
        //        if (type == ExceptionType.Fault) {
        //            return;
        //        }
        //        Assert.Fail("Got and exption type {0} while expecting ", e.GetType().Name, type.ToString());
        //    }
        //    catch (Exception e) {
        //        Assert.Fail("Got and exption type {0} while expecting ", e.GetType().Name, type.ToString());
        //    }
        //}

        #endregion

        #region Private Methods

        private void Validate(ErrReport err, int code, string method, string msg)
        {
            TestHelpers.ValidateErrReport(err, code, "ValidatorTests", method, msg);
//            Assert.AreEqual("", err.StackTrace);
        }