Пример #1
0
        public void CookieParameter_AssignToDefaultProperties()
        {
            CookieParameterPoker cookieParam = new CookieParameterPoker();

            cookieParam.CookieName = "CookieNameTest";
            Assert.AreEqual("CookieNameTest", cookieParam.CookieName, "AssignToCookieName");
        }
Пример #2
0
        public void CookieParameter_Clone()
        {
            HttpCookie           cookie      = new HttpCookie("EmployeeCookie");
            CookieParameterPoker cookieParam = new CookieParameterPoker("Employee", TypeCode.String, "EmployeeCookie");
            CookieParameter      clonedParam = (CookieParameter)cookieParam.DoClone();

            Assert.AreEqual("Employee", clonedParam.Name, "CookieParameterCloneName");
            Assert.AreEqual(TypeCode.String, clonedParam.Type, "CookieParameterCloneType");
            Assert.AreEqual("EmployeeCookie", clonedParam.CookieName, "CookieParameterCloneCookieName");
        }
Пример #3
0
        public void CookieParameter_DefaultProperties()
        {
            CookieParameterPoker cookieParam1 = new CookieParameterPoker();

            Assert.AreEqual("", cookieParam1.CookieName, "DefaultCookieName");
            CookieParameterPoker cookieParam2 = new CookieParameterPoker("CookieTest", "CookieName");

            Assert.AreEqual("CookieTest", cookieParam2.Name, "OverloadContructorName1");
            Assert.AreEqual("CookieName", cookieParam2.CookieName, "OverloadContructorCookieName1");
            CookieParameterPoker cookieParam3 = new CookieParameterPoker("Salary", TypeCode.UInt64, "SalaryCookie");

            Assert.AreEqual("Salary", cookieParam3.Name, "OverloadContructorName2");
            Assert.AreEqual("SalaryCookie", cookieParam3.CookieName, "OverloadContructorCookieName2");
            Assert.AreEqual(TypeCode.UInt64, cookieParam3.Type, "OverloadContructorType");
            CookieParameterPoker cookieParam4 = new CookieParameterPoker(cookieParam3);

            Assert.AreEqual("Salary", cookieParam4.Name, "OverloadContructorName2");
            Assert.AreEqual("SalaryCookie", cookieParam4.CookieName, "OverloadContructorCookieName2");
            Assert.AreEqual(TypeCode.UInt64, cookieParam4.Type, "OverloadContructorType");
        }
Пример #4
0
        public void CookieParameter_Evaluate()
        {
            CookieParameterPoker cookieParam = new CookieParameterPoker("Salary", TypeCode.Int64, "SalaryCookie");
            HttpRequest          request     = new HttpRequest(String.Empty, "http://www.mono-project.com", String.Empty);
            HttpResponse         response    = new HttpResponse(new StringWriter());
            HttpCookie           cookie      = new HttpCookie("SalaryCookie", "1000");
            Label  lbl   = new Label();
            string value = (string)cookieParam.DoEvaluate(null, lbl);

            Assert.AreEqual(null, value, "EvaluateWhenNullContext");
            HttpContext context = new HttpContext(request, response);

            response.Cookies.Add(cookie);
            request.Cookies.Add(cookie);
            value = (string)cookieParam.DoEvaluate(context, lbl);
            Assert.AreEqual("1000", value, "EvaluateCookieValue1");
            cookie.Value = "2000";
            value        = (string)cookieParam.DoEvaluate(context, lbl);
            Assert.AreEqual("2000", value, "EvaluateCookieValue2");
        }
Пример #5
0
		public void CookieParameter_DefaultProperties ()
		{
			CookieParameterPoker cookieParam1 = new CookieParameterPoker ();
			Assert.AreEqual ("", cookieParam1.CookieName, "DefaultCookieName"); 
			CookieParameterPoker cookieParam2 = new CookieParameterPoker ("CookieTest", "CookieName");
			Assert.AreEqual ("CookieTest", cookieParam2.Name, "OverloadContructorName1");
			Assert.AreEqual ("CookieName", cookieParam2.CookieName, "OverloadContructorCookieName1"); 
			CookieParameterPoker cookieParam3 = new CookieParameterPoker ("Salary", TypeCode.UInt64, "SalaryCookie");
			Assert.AreEqual ("Salary", cookieParam3.Name, "OverloadContructorName2");
			Assert.AreEqual ("SalaryCookie",cookieParam3.CookieName ,"OverloadContructorCookieName2");
			Assert.AreEqual (TypeCode.UInt64, cookieParam3.Type, "OverloadContructorType");  
			CookieParameterPoker cookieParam4 = new CookieParameterPoker (cookieParam3);
			Assert.AreEqual ("Salary", cookieParam4.Name, "OverloadContructorName2");
			Assert.AreEqual ("SalaryCookie", cookieParam4.CookieName, "OverloadContructorCookieName2");
			Assert.AreEqual (TypeCode.UInt64, cookieParam4.Type, "OverloadContructorType");  		
			
			
		}
Пример #6
0
		public void CookieParameter_Evaluate ()
		{
			CookieParameterPoker cookieParam = new CookieParameterPoker ("Salary", TypeCode.Int64, "SalaryCookie");
			HttpRequest request = new HttpRequest (String.Empty, "http://www.mono-project.com", String.Empty);
			HttpResponse response= new HttpResponse (new StringWriter());			
			HttpCookie cookie = new HttpCookie ("SalaryCookie", "1000");			
			Label lbl = new Label ();
			string value = (string) cookieParam.DoEvaluate (null, lbl);
			Assert.AreEqual (null, value, "EvaluateWhenNullContext");
			HttpContext context = new HttpContext (request,response);
			response.Cookies.Add (cookie) ;
			request.Cookies.Add (cookie);			
			value = (string)cookieParam.DoEvaluate (context, lbl);
			Assert.AreEqual ("1000", value, "EvaluateCookieValue1");
			cookie.Value = "2000";
			value = (string) cookieParam.DoEvaluate (context, lbl);
			Assert.AreEqual ("2000", value, "EvaluateCookieValue2");
			
		}
Пример #7
0
		public void CookieParameter_Clone ()
		{
			HttpCookie cookie = new HttpCookie ("EmployeeCookie");
			CookieParameterPoker cookieParam = new CookieParameterPoker ("Employee", TypeCode.String ,"EmployeeCookie");
			CookieParameter clonedParam = (CookieParameter) cookieParam.DoClone ();
			Assert.AreEqual ("Employee", clonedParam.Name, "CookieParameterCloneName");
			Assert.AreEqual (TypeCode.String, clonedParam.Type, "CookieParameterCloneType");
			Assert.AreEqual ("EmployeeCookie", clonedParam.CookieName, "CookieParameterCloneCookieName");			
		}
Пример #8
0
		public void CookieParameter_AssignToDefaultProperties ()
		{
			CookieParameterPoker cookieParam = new CookieParameterPoker ();
			cookieParam.CookieName = "CookieNameTest";
			Assert.AreEqual ("CookieNameTest", cookieParam.CookieName, "AssignToCookieName");			
		}