AddTransientGiven() public static méthode

public static AddTransientGiven ( string testName, string context, Delegate given ) : void
testName string
context string
given System.Delegate
Résultat void
Exemple #1
0
        public static Tuple <T1, T2, T3> Given <T1, T2, T3>(string context)
        {
            var currentTest = new StackFrame(1).GetMethod().DeclaringType.Name;
            var key         = currentTest + context;

            if (!TestRunContext.ContainsKey(key))
            {
                var given = ((context <T1, T2, T3>)Contexts[context]);
                TestRunManager.AddTransientGiven(currentTest, context, given);
                TestRunContext.Add(key, ((context <T1, T2, T3>)Contexts[context]).Invoke());
            }

            return((Tuple <T1, T2, T3>)TestRunContext[key]);
        }
Exemple #2
0
        public static GivenResult Given(string context)
        {
            var currentTest = new StackFrame(1).GetMethod().DeclaringType.Name;
            var key         = currentTest + context;

            if (TestRunContext.ContainsKey(key))
            {
                return new GivenResult {
                           Executed = false
                }
            }
            ;

            TestRunManager.AddTransientGiven(currentTest, context, Contexts[context]);

            var given  = Contexts[context];
            var result = given.DynamicInvoke();

            TestRunContext.Add(key, result);

            return(new GivenResult {
                Executed = true
            });
        }