public void QueryStringParameter_AssignToDefaultProperties() { QueryStringParameterPoker queryParam = new QueryStringParameterPoker(); queryParam.QueryStringField = "Test"; Assert.AreEqual("Test", queryParam.QueryStringField, "AssignToQueryStringField"); }
public void QueryStringParameter_Clone() { QueryStringParameterPoker queryParam = new QueryStringParameterPoker("EmployeeName", TypeCode.String, "Name"); QueryStringParameter clonedParam = (QueryStringParameter)queryParam.DoClone(); Assert.AreEqual("EmployeeName", clonedParam.Name, "QueryStringParameterCloneName"); Assert.AreEqual(TypeCode.String, clonedParam.Type, "QueryStringParameterCloneType"); Assert.AreEqual("Name", clonedParam.QueryStringField, "QueryStringParameterCloneFormField"); }
public void QueryStringParameter_DefaultProperties() { QueryStringParameterPoker queryParam1 = new QueryStringParameterPoker(); Assert.AreEqual("", queryParam1.QueryStringField, "DefaultQueryStringField"); QueryStringParameterPoker queryParam2 = new QueryStringParameterPoker("Name", "id"); Assert.AreEqual("Name", queryParam2.Name, "OverloadConstructorName1"); Assert.AreEqual("id", queryParam2.QueryStringField, "OverloadConstructorQueryStringField1"); QueryStringParameterPoker queryParam3 = new QueryStringParameterPoker("Name", TypeCode.Int64, "id"); Assert.AreEqual("Name", queryParam3.Name, "OverloadConstructorName2"); Assert.AreEqual("id", queryParam3.QueryStringField, "OverloadConstructorQueryStringField2"); Assert.AreEqual(TypeCode.Int64, queryParam3.Type, "OverloadConstructorType2"); QueryStringParameterPoker queryParam4 = new QueryStringParameterPoker(queryParam3); Assert.AreEqual("Name", queryParam4.Name, "OverloadConstructorName3"); Assert.AreEqual("id", queryParam4.QueryStringField, "OverloadConstructorQueryStringField3"); Assert.AreEqual(TypeCode.Int64, queryParam4.Type, "OverloadConstructorType3"); }
public void QueryStringParameter_Evaluate() { QueryStringParameterPoker queryParam = new QueryStringParameterPoker("Employee", TypeCode.Int32, "id"); HttpRequest request = new HttpRequest(String.Empty, "http://www.mono-project.com", "id=332"); HttpResponse response = new HttpResponse(new StringWriter()); TextBox tb = new TextBox(); tb.ID = "id"; string value = (string)queryParam.DoEvaluate(null, tb); Assert.AreEqual(null, value, "EvaluateWhenNullContext"); HttpContext context = new HttpContext(request, response); value = (string)queryParam.DoEvaluate(context, tb); Assert.AreEqual("332", value, "EvaluateQueryString1"); value = (string)queryParam.DoEvaluate(context, null); Assert.AreEqual("332", value, "EvaluateQueryString1"); request = new HttpRequest(String.Empty, "http://www.mono-project.com", "id=500"); context = new HttpContext(request, response); value = (string)queryParam.DoEvaluate(context, tb); Assert.AreEqual("500", value, "EvaluateQueryString2"); }
public void QueryStringParameter_Evaluate() { QueryStringParameterPoker queryParam = new QueryStringParameterPoker("Employee", TypeCode.Int32, "id"); HttpRequest request = new HttpRequest(String.Empty, "http://www.mono-project.com","id=332"); HttpResponse response = new HttpResponse(new StringWriter()); TextBox tb = new TextBox(); tb.ID = "id"; string value = (string)queryParam.DoEvaluate(null, tb); Assert.AreEqual(null, value, "EvaluateWhenNullContext"); HttpContext context = new HttpContext(request, response); value = (string)queryParam.DoEvaluate(context, tb); Assert.AreEqual("332", value, "EvaluateQueryString1"); value = (string) queryParam.DoEvaluate (context, null); Assert.AreEqual ("332", value, "EvaluateQueryString1"); request = new HttpRequest (String.Empty, "http://www.mono-project.com", "id=500"); context = new HttpContext(request, response); value = (string)queryParam.DoEvaluate(context, tb); Assert.AreEqual("500", value, "EvaluateQueryString2"); }
public void QueryStringParameter_Clone() { QueryStringParameterPoker queryParam = new QueryStringParameterPoker("EmployeeName", TypeCode.String, "Name"); QueryStringParameter clonedParam = (QueryStringParameter)queryParam.DoClone(); Assert.AreEqual("EmployeeName", clonedParam.Name, "QueryStringParameterCloneName"); Assert.AreEqual(TypeCode.String, clonedParam.Type, "QueryStringParameterCloneType"); Assert.AreEqual("Name", clonedParam.QueryStringField , "QueryStringParameterCloneFormField"); }