public void ContentWithOneOfTwoMatchingPairMatches() { // Will always match SimulationConditionEvaluator e = new SimulationConditionEvaluator(); SimulationCondition c = new SimulationCondition(); c.Parameter("c", "d"); c.Parameter("a", "b"); System.Net.Http.HttpContent content = new System.Net.Http.StringContent("a=b", Encoding.UTF8, "application/json"); Assert.IsFalse(e.MatchesBodyParameters(c, content)); }
public void OneConditionMatchesCaseInsensitivePartialValue() { SimulationCondition c = new SimulationCondition(); c.Parameter("A", "bcD", ComparisonType.PartialValue | ComparisonType.CaseInsensitive, ParameterType.UrlParameter); Assert.IsTrue(Evaluator.MatchesUrlParameters(c, "A=bcD")); }
public void OneConditionButNoParameters() { List<Parameter> ps = new List<Parameter>(); SimulationCondition c = new SimulationCondition(); c.Parameter("thename", "thevalue"); Assert.IsFalse(Evaluator.Matches(c, ps)); }
public void ExactlyOneParameterMatch() { List<Parameter> ps = new List<Parameter>(); ps.Add(new Parameter("thename", "thevalue")); SimulationCondition c = new SimulationCondition(); c.Parameter("thename", "thevalue"); Assert.IsTrue(Evaluator.Matches(c, ps)); }
public void OneConditionMatchesCaseSensitiveFails() { SimulationCondition c = new SimulationCondition(); c.Parameter("A", "b", ParameterType.UrlParameter); Assert.IsFalse(Evaluator.MatchesUrlParameters(c, "a=b")); }
public void OneConditionWithoutEncoding() { SimulationCondition c = new SimulationCondition(); c.Parameter("d/e", "f/g", ParameterType.UrlParameter); Assert.IsFalse(Evaluator.MatchesUrlParameters(c, "d%2fe=f%2fg")); }
public void OneConditionWithEncoding() { SimulationCondition c = new SimulationCondition(); c.Parameter("d/e", "f/g", ComparisonType.UrlEncode, ParameterType.UrlParameter); Assert.IsTrue(Evaluator.MatchesUrlParameters(c, "d%2fe=f%2fg")); }
public void OneConditionWithBodyParameterDoesNotMatch() { SimulationCondition c = new SimulationCondition(); c.Parameter("d", "e", ParameterType.BodyParameter); c.Parameter("g", "h", ParameterType.UrlParameter); Assert.IsFalse(Evaluator.MatchesUrlParameters(c, "d=e")); }
public void OneParameterButNotAMatch() { List<Parameter> ps = new List<Parameter>(); ps.Add(new Parameter("thename2", "thevalue2")); SimulationCondition c = new SimulationCondition(); c.Parameter("thename", "thevalue"); Assert.IsFalse(Evaluator.Matches(c, ps)); }
public void ParameterPartialValueCaseSensitive() { List<Parameter> ps = new List<Parameter>(); ps.Add(new Parameter("thename", "thevalue")); SimulationCondition c = new SimulationCondition(); c.Parameter("thename", "eval", ComparisonType.PartialValue); Assert.IsTrue(Evaluator.Matches(c, ps)); }
public void ParameterExistsValueIgnored2() { List<Parameter> ps = new List<Parameter>(); ps.Add(new Parameter("thename", "thevalue")); SimulationCondition c = new SimulationCondition(); c.Parameter("thename"); Assert.IsTrue(Evaluator.Matches(c, ps)); }
public void TwoConditionsSecondOneMatches() { SimulationConditionEvaluator e = new SimulationConditionEvaluator(); SimulationCondition c1 = new SimulationCondition(); c1.Parameter("c", "d"); c1.Parameter("g", "h"); SimulationCondition c2 = new SimulationCondition(); c2.Parameter("c", "d"); c2.Parameter("e", "f"); System.Net.Http.HttpContent content = new System.Net.Http.StringContent("a=b&c=d&e=f", Encoding.UTF8, "application/json"); Assert.IsFalse(e.MatchesBodyParameters(c1, content)); Assert.IsTrue(e.MatchesBodyParameters(c2, content)); }
public void ContentWithTwoOfThreeMatchingPairMatches() { SimulationConditionEvaluator e = new SimulationConditionEvaluator(); SimulationCondition c = new SimulationCondition(); c.Parameter("c", "d"); c.Parameter("a", "b"); System.Net.Http.HttpContent content = new System.Net.Http.StringContent("a=b&c=d&e=f", Encoding.UTF8, "application/json"); Assert.IsTrue(e.MatchesBodyParameters(c, content)); }