Beispiel #1
0
        public void TriggerIfStackContainsTestMethodBase()
        {
            MethodInfo method    = ((Action)TriggerIfStackContainsTestMethodBase).Method;
            ICondition condition = BuiltInConditions.TriggerIfStackContains(method);

            DoTriggerIfStackContainsTests(condition);
        }
Beispiel #2
0
        public void TriggerIfStackContainsTestString()
        {
            string     method    = "Microsoft.Test.AcceptanceTests.FaultInjection.BuiltInTriggerTests.TriggerIfStackContainsTestString()";
            ICondition condition = BuiltInConditions.TriggerIfStackContains(method);

            DoTriggerIfStackContainsTests(condition);
        }
Beispiel #3
0
        public void TriggerIfStackContainsTest()
        {
            string         method    = "System.RuntimeMethodHandle._InvokeMethodFast(System.Object,System.Object[],ref System.SignatureStruct,System.Reflection.MethodAttributes,System.RuntimeTypeHandle)";
            ICondition     condition = BuiltInConditions.TriggerIfStackContains(method);
            RuntimeContext ctx       = new RuntimeContext();

            ctx.CallStack = new CallStack(new StackTrace(0));

            int loopTimes = 10;

            for (int i = 0; i < loopTimes; ++i)
            {
                Assert.True(condition.Trigger(ctx));
            }
            ctx.CallStack = new CallStack(new StackTrace(6));
            for (int i = 0; i < loopTimes; ++i)
            {
                Assert.False(condition.Trigger(ctx));
            }
        }