public void InjectPredicate_Constructor_SetsInjectedFunction() { const string injectedFunction = "function(config) { return true; }"; var predicate = new InjectPredicate(injectedFunction); Assert.AreEqual(injectedFunction, predicate.InjectedFunction); }
/// <summary> /// Adds a predicate to the stub that allows you to inject JavaScript to determine if the /// predicate should match or not. /// </summary> /// <param name="injectedFunction">JavaScript function that accepts the request object (and /// optionally a logger) and returns true or false</param> /// <returns>The stub that the predicate was added to</returns> public HttpStub OnInjectedFunction(string injectedFunction) { var predicate = new InjectPredicate(injectedFunction); return(On(predicate)); }