示例#1
0
        /// <inheritdoc />
        public IEnumerable <Assert> CreateAssert(KeyValuePairRule rule, IEnumerable <KeyValuePair <string, string> > request)
        {
            var ruleAsserts = new List <Assert>();

            foreach (var kvpRequest in request)
            {
                if (kvpRequest.Key == rule.RuleValue.Key)
                {
                    var queryheaderkeyassert = new Assert()
                    {
                        Expect = rule.RuleValue.Key,
                        Actual = kvpRequest.Key,
                        Rule   = ComparerType.TEXTEQUALS
                    };

                    var queryheadervalueassert = new Assert()
                    {
                        Actual = kvpRequest.Value, Expect = rule.RuleValue.Value, Rule = rule.Type
                    };

                    ruleAsserts.Add(queryheaderkeyassert);
                    ruleAsserts.Add(queryheadervalueassert);
                }
            }
            return(ruleAsserts);
        }
示例#2
0
        public void KeyValuePairRuleEqualsRuleFailsTest()
        {
            var Target = this.fakerKeyValuePairRule.Generate();
            var input  = new KeyValuePairRule()
            {
                Type = Target.Type, RuleValue = new KeyValuePair <string, string>()
            } as object;

            Assert.False(Target.Equals(input));
        }
示例#3
0
        public void KeyValuePairRuleEqualsSuccessTest()
        {
            var Target = this.fakerKeyValuePairRule.Generate();

            var input = new KeyValuePairRule()
            {
                Type = Target.Type, RuleValue = Target.RuleValue
            };

            Assert.True(Target.Equals(input));
        }
示例#4
0
        public void KeyValuePairRuleEqualsTypeFailsTest()
        {
            var Target = this.fakerKeyValuePairRule.Generate();

            Target.Type = ComparerType.TEXTEQUALS;
            var input = new KeyValuePairRule()
            {
                Type = ComparerType.TEXTCONTAINS, RuleValue = Target.RuleValue
            };

            Assert.False(Target.Equals(input));
        }
示例#5
0
        /// <inheritdoc />
        public IEnumerable <Assert> CreateAssert(KeyValuePairRule rules, string request)
        {
            var asserts   = new List <Assert>();
            var UrlAssert = new Assert()
            {
                Actual = request, Expect = rules.RuleValue.Value, Rule = rules.Type
            };

            asserts.Add(UrlAssert);

            return(asserts);
        }