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));
        }
Exemple #2
0
        public void OneConditionMatchesCaseInsensitivePartialValue()
        {
            SimulationCondition c = new SimulationCondition();
            c.Parameter("A", "bcD", ComparisonType.PartialValue | ComparisonType.CaseInsensitive, ParameterType.UrlParameter);

            Assert.IsTrue(Evaluator.MatchesUrlParameters(c, "A=bcD"));
        }
Exemple #3
0
        public void OneConditionButNoParameters()
        {
            List<Parameter> ps = new List<Parameter>();

            SimulationCondition c = new SimulationCondition();
            c.Parameter("thename", "thevalue");

            Assert.IsFalse(Evaluator.Matches(c, ps));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        public void OneConditionMatchesCaseSensitiveFails()
        {
            SimulationCondition c = new SimulationCondition();
            c.Parameter("A", "b", ParameterType.UrlParameter);

            Assert.IsFalse(Evaluator.MatchesUrlParameters(c, "a=b"));
        }
Exemple #6
0
        public void OneConditionWithoutEncoding()
        {
            SimulationCondition c = new SimulationCondition();
            c.Parameter("d/e", "f/g", ParameterType.UrlParameter);

            Assert.IsFalse(Evaluator.MatchesUrlParameters(c, "d%2fe=f%2fg"));
        }
Exemple #7
0
        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"));
        }
Exemple #8
0
        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"));
        }
Exemple #9
0
        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));
        }
Exemple #10
0
        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));
        }
Exemple #11
0
        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));
        }