Beispiel #1
0
        public void HeaderAndValueConditionNotExistsButNotExists()
        {
            List<Header> headers = new List<Header>();

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", "TheValue", ComparisonType.NotExists);

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #2
0
        public void HeaderAndValueImplicitNoneIsSkipped()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", "TheValue", Persistence.None);

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #3
0
        public void HeaderAndValueImplicitExists()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", "TheValue");

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #4
0
        public void OneHeaderOnlyUrlEncodedNotMatch()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheH%2feader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheH/eader", ComparisonType.Exists);

            Assert.IsFalse(Evaluator.Matches(c, headers));
        }
Beispiel #5
0
        public void TwoConditionsSameHeaderNameDifferentValuesMatchesLast()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue1"));
            headers.Add(new Header("TheHeader", "TheValue2"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", "TheValue2");

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #6
0
        public void OneHeaderMatchesCaseSensitive()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", "TheValue");

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #7
0
        public void OneHeaderOnlyExistsComparisonCaseSensitive2()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHEader", ComparisonType.Exists | ComparisonType.CaseSensitive);

            Assert.IsFalse(Evaluator.Matches(c, headers));
        }
Beispiel #8
0
        public void OneHeaderAndValueOnlyUrlEncodedMatch()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheH%2feader", "TheV%2falue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheH/eader", "TheV/alue", ComparisonType.Exists | ComparisonType.UrlEncode);

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #9
0
        public void OneHeaderExistsComparison()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", "TheValue", ComparisonType.Exists);

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #10
0
        public void OneConditionMatchesAgainstTwoSecond()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));
            headers.Add(new Header("TheHeader2", "TheValue2"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader2", "TheValue2");

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #11
0
        public void NullHeadersAlwaysMatches()
        {
            SimulationCondition c = new SimulationCondition();
            Assert.IsTrue(Evaluator.Matches(c, (IEnumerable<Header>) null));

            c.Header("TheHeader", "Woo");
            Assert.IsTrue(Evaluator.Matches(c, (IEnumerable<Header>)null));
        }
Beispiel #12
0
        public void HeaderPartialValueMatchCaseSensitive()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", "eVal", ComparisonType.PartialValue);

            Assert.IsTrue(Evaluator.Matches(c, headers));
        }
Beispiel #13
0
        public void HeaderOnlyNotExistsImplicitNoHeaders()
        {
            List<Header> headers = new List<Header>();

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader");

            Assert.IsFalse(Evaluator.Matches(c, headers));
        }
Beispiel #14
0
        public void HeaderOnlyNotExists()
        {
            List<Header> headers = new List<Header>();
            headers.Add(new Header("TheHeader", "TheValue"));

            SimulationCondition c = new SimulationCondition();
            c.Header("TheHeader", ComparisonType.NotExists);

            Assert.IsFalse(Evaluator.Matches(c, headers));
        }