public override /*virtual*/ void Eval(MockRAMDirectory dir) { System.Diagnostics.StackTrace trace = StackTraceHelper.Create(); var frames = trace.GetFrames(); for (int i = 0; i < frames.Length; i++) { System.Diagnostics.StackFrame sf = frames[i]; if ("DoMerge".Equals(sf.GetMethod().Name)) { throw new System.IO.IOException("now failing during merge"); } } }
public override void Eval(MockRAMDirectory dir) { if (doFail && !(Thread.CurrentThread.Name ?? "").Contains("Merge Thread")) { System.Diagnostics.StackTrace trace = StackTraceHelper.Create(); var frames = trace.GetFrames(); for (int i = 0; i < frames.Length; i++) { System.Diagnostics.StackFrame sf = frames[i]; if ("DoFlush".Equals(sf.GetMethod().Name)) { hitExc = true; //Console.WriteLine(trace); throw new System.IO.IOException("now failing during flush"); } } } }
public override void Eval(MockRAMDirectory dir) { if (sawMaybe && !failed) { bool seen = false; System.Diagnostics.StackTrace trace = StackTraceHelper.Create(); var frames = trace.GetFrames(); for (int i = 0; i < frames.Length; i++) { System.Diagnostics.StackFrame sf = frames[i]; if ("ApplyDeletes".Equals(sf.GetMethod().Name)) { seen = true; break; } } if (!seen) { // Only fail once we are no longer in applyDeletes failed = true; throw new System.IO.IOException("fail after applyDeletes"); } } if (!failed) { System.Diagnostics.StackTrace trace = StackTraceHelper.Create(); var frames = trace.GetFrames(); for (int i = 0; i < frames.Length; i++) { System.Diagnostics.StackFrame sf = frames[i]; if ("ApplyDeletes".Equals(sf.GetMethod().Name)) { sawMaybe = true; break; } } } }
static string GetTestCaseName(bool fullName) { System.Diagnostics.StackTrace trace = StackTraceHelper.Create(); var frames = trace.GetFrames(); for (int i = 0; i < frames.Length; i++) { System.Reflection.MethodBase method = frames[i].GetMethod(); object[] testAttrs = method.GetCustomAttributes(typeof(NUnit.Framework.TestAttribute), false).ToArray(); if (testAttrs != null && testAttrs.Length > 0) { if (fullName) { return(method.DeclaringType.FullName + "." + method.Name); } else { return(method.Name); } } } return("GetTestCaseName[UnknownTestMethod]"); }