public void OrderOfOpperations_NotFollowed_LastMiddleFirst()
        {
            // arrange
            var processor = new RuleFlagProcessor();

            // act
            processor.BeginAdd();
            processor.Add(new ProxyFlag());
            processor.Add(new NoCaseFlag());
            processor.Add(new LastFlag());
            processor.Add(new NoEscapeFlag());
            processor.Add(new ResponseCookieFlag("test", "test", "test", null, "/"));
            processor.Add(new LastFlag());
            processor.EndAdd();

            // assert
            var list = processor.ToList();

            Assert.IsInstanceOf <NoCaseFlag>(list[0]);
            Assert.IsInstanceOf <NoEscapeFlag>(list[1]);
            Assert.IsInstanceOf <ResponseCookieFlag>(list[2]);
            Assert.IsInstanceOf <ProxyFlag>(list[3]);
            Assert.IsInstanceOf <LastFlag>(list[4]);
            Assert.IsInstanceOf <LastFlag>(list[5]);
        }
        /// <summary>
        /// Splits the rule flags.
        /// </summary>
        /// <param name="flags">The flags.</param>
        /// <returns></returns>
        protected IRuleFlagProcessor SplitRuleFlags(string flags)
        {
            RuleFlagProcessor dictionary       = new RuleFlagProcessor();
            List <string>     temporaryHolding = new List <string>();

            dictionary.BeginAdd();
            foreach (string flag in flags.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                string temp = flag;

                if (flag.Contains("\"") || temporaryHolding.Count > 0)
                {
                    temporaryHolding.Add(flag.Replace("\"", String.Empty));

                    if (flag.Contains("\"") && temporaryHolding.Count > 1)
                    {
                        temp = String.Join(",", temporaryHolding.ToArray());
                        temporaryHolding.Clear();
                    }
                    else
                    {
                        continue;
                    }
                }

                IRuleFlag ruleFlag = AddRuleFlag(temp);
                if (ruleFlag != null)
                {
                    dictionary.Add(ruleFlag);
                }
            }
            dictionary.EndAdd();

            return(dictionary);
        }
		public void OrderOfOpperations_Followed_3()
		{
			// arrange
			var processor = new RuleFlagProcessor();

			// act
			processor.BeginAdd();
			processor.Add(new NoCaseFlag());
			processor.Add(new NoEscapeFlag());
			processor.Add(new ResponseCookieFlag("test", "test", "test", null, "/"));
			processor.Add(new RedirectFlag(302));
			processor.EndAdd();

			// assert
			var list = processor.ToList();
			Assert.IsInstanceOf<NoCaseFlag>(list[0]);
			Assert.IsInstanceOf<NoEscapeFlag>(list[1]);
			Assert.IsInstanceOf<ResponseCookieFlag>(list[2]);
			Assert.IsInstanceOf<RedirectFlag>(list[3]);
		}
        public void OrderOfOpperations_Followed_3()
        {
            // arrange
            var processor = new RuleFlagProcessor();

            // act
            processor.BeginAdd();
            processor.Add(new NoCaseFlag());
            processor.Add(new NoEscapeFlag());
            processor.Add(new ResponseCookieFlag("test", "test", "test", null, "/"));
            processor.Add(new RedirectFlag(302));
            processor.EndAdd();

            // assert
            var list = processor.ToList();

            Assert.IsInstanceOf <NoCaseFlag>(list[0]);
            Assert.IsInstanceOf <NoEscapeFlag>(list[1]);
            Assert.IsInstanceOf <ResponseCookieFlag>(list[2]);
            Assert.IsInstanceOf <RedirectFlag>(list[3]);
        }
		public void OrderOfOpperations_NotFollowed_LastMiddleFirst()
		{
			// arrange
			var processor = new RuleFlagProcessor();

			// act
			processor.BeginAdd();
			processor.Add(new ProxyFlag());
			processor.Add(new NoCaseFlag());
			processor.Add(new LastFlag());
			processor.Add(new NoEscapeFlag());
			processor.Add(new ResponseCookieFlag("test", "test", "test", null, "/"));
			processor.Add(new LastFlag());
			processor.EndAdd();

			// assert
			var list = processor.ToList();
			Assert.IsInstanceOf<NoCaseFlag>(list[0]);
			Assert.IsInstanceOf<NoEscapeFlag>(list[1]);
			Assert.IsInstanceOf<ResponseCookieFlag>(list[2]);
			Assert.IsInstanceOf<ProxyFlag>(list[3]);
			Assert.IsInstanceOf<LastFlag>(list[4]);
			Assert.IsInstanceOf<LastFlag>(list[5]);
		}