/// <summary></summary> public static string RunAll() { string retVal = ""; //GetString string strResult = WebServiceTests.GetString("Input"); if (strResult != "Input-Processed") { throw new Exception("Should be Input-Processed"); } retVal += "GetString: Passed.\r\n"; strResult = WebServiceTests.GetStringNull("Input"); if (strResult != null) { throw new Exception("Should be null"); } retVal += "GetStringNull: Passed.\r\n"; strResult = WebServiceTests.GetStringCarriageReturn("Carriage\r\nReturn"); if (strResult != "Carriage\r\nReturn-Processed") { throw new Exception("Should be Carriage\r\nReturn-Processed"); } retVal += "GetStringCarriageReturn: Passed.\r\n"; //GetInt int intResult = WebServiceTests.GetInt(1); if (intResult != 2) { throw new Exception("Should be 2"); } retVal += "GetInt: Passed.\r\n"; //GetLong long longResult = WebServiceTests.GetLong(1); if (longResult != 2) { throw new Exception("Should be 2"); } retVal += "GetLong: Passed.\r\n"; //GetVoid WebServiceTests.GetVoid(); retVal += "GetVoid: Passed.\r\n"; //GetBool bool boolResult = WebServiceTests.GetBool(); if (boolResult != true) { throw new Exception("Should be true"); } retVal += "GetBool: Passed.\r\n"; //GetObject Patient pat = WebServiceTests.GetObjectPat(); if (pat.LName != "Smith") { throw new Exception("Should be Smith"); } if (pat.FName != null) { throw new Exception("Should be null"); } retVal += "GetObjectPat: Passed.\r\n"; //GetTable DataTable table = WebServiceTests.GetTable(); if (table.Rows[0][0].ToString() != "cell00") { throw new Exception("Should be cell00"); } retVal += "GetTable: Passed.\r\n"; //GetTable with carriage return table = WebServiceTests.GetTableCarriageReturn(); if (table.Rows[0][0].ToString() != "cell\r\n00") { throw new Exception("Should be cell\r\n00"); } retVal += "GetTableCarriageReturn: Passed.\r\n"; //GetDataSet DataSet ds = WebServiceTests.GetDataSet(); if (ds.Tables[0].TableName != "table0") { throw new Exception("Should be table0"); } retVal += "GetDataSet: Passed.\r\n"; //GetList List <int> listInt = WebServiceTests.GetListInt(); if (listInt[0] != 2) { throw new Exception("Should be 2"); } retVal += "GetListInt: Passed.\r\n"; //GetArrayPatient Patient[] arrayPat = WebServiceTests.GetArrayPatient(); if (arrayPat[0].LName != "Jones") { throw new Exception("Should be Jones"); } if (arrayPat[1] != null) { throw new Exception("Should be null"); } retVal += "GetArrayPatient: Passed.\r\n"; //SendNullParam strResult = WebServiceTests.SendNullParam(null); if (strResult != "nullOK") { throw new Exception("Should be nullOK"); } retVal += "SendNullParam: Passed.\r\n"; //GetObjectNull Patient pat2 = WebServiceTests.GetObjectNull(); if (pat2 != null) { throw new Exception("Should be null"); } retVal += "GetObjectNull: Passed.\r\n"; //SendColorParam Color colorResult = WebServiceTests.SendColorParam(Color.Fuchsia); if (colorResult.ToArgb() != Color.Green.ToArgb()) { throw new Exception("Should be green."); } retVal += "SendColorParam: Passed.\r\n"; //SendProviderColor Provider prov = new Provider(); prov.ProvColor = Color.Fuchsia; strResult = WebServiceTests.SendProviderColor(prov); if (strResult != "fuchsiaOK") { throw new Exception("Should be fuchsiaOK."); } retVal += "SendProviderColor: Passed.\r\n"; //SendSheetParameter SheetParameter sheetParam = new SheetParameter(false, "ParamNameOK"); strResult = WebServiceTests.SendSheetParameter(sheetParam); if (strResult != "paramNameOK") { throw new Exception("Should be paramNameOK."); } retVal += "SendSheetParameter: Passed.\r\n"; //SendSheetWithFields Sheet sheet = new Sheet(); sheet.SheetFields = new List <SheetField>(); sheet.Parameters = new List <SheetParameter>(); SheetField field = new SheetField(); field.FieldName = "FieldNameGreen"; sheet.SheetFields.Add(field); strResult = WebServiceTests.SendSheetWithFields(sheet); if (strResult != "fieldOK") { throw new Exception("Should be fieldOK."); } retVal += "SendSheetWithFields: Passed.\r\n"; //SendSheetDefWithFields SheetDef sheetdef = new SheetDef(); sheetdef.SheetFieldDefs = new List <SheetFieldDef>(); sheetdef.Parameters = new List <SheetParameter>(); SheetFieldDef fielddef = new SheetFieldDef(); fielddef.FieldName = "FieldNameTeal"; sheetdef.SheetFieldDefs.Add(fielddef); strResult = WebServiceTests.SendSheetDefWithFieldDefs(sheetdef); if (strResult != "fielddefOK") { throw new Exception("Should be fielddefOK."); } retVal += "SendSheetDefWithFieldDefs: Passed.\r\n"; //TimeSpanNeg TimeSpan tspan = WebServiceTests.GetTimeSpan(); if (tspan != new TimeSpan(1, 0, 0)) { throw new Exception("Should be 1 hour."); } retVal += "GetTimeSpan: Passed.\r\n"; //GetStringContainingCR //fails, but we have a strategy to fix some day by putting serialization code into the crud layer. /* * strResult=WebServiceTests.GetStringContainingCR(); * strResult=strResult.Replace("\\r","\r"); * if(strResult!="Line1\r\nLine2") { * throw new Exception("Should be Line1\r\nLine2"); * } * retVal+="GetStringContainingCR: Passed.\r\n"; * //GetListTasksContainingCR * Task task=WebServiceTests.GetListTasksContainingCR()[0]; * if(task.Descript!="Line1\r\nLine2") { * throw new Exception("Should be Line1\r\nLine2"); * } * retVal+="GetListTasksContainingCR: Passed.\r\n";*/ return(retVal); }
/// <summary></summary> public static string RunAll() { string retVal = ""; //GetString string strResult = WebServiceTests.GetString("Input"); if (strResult != "Input-Processed") { throw new Exception("Should be Input-Processed"); } retVal += "GetString: Passed.\r\n"; strResult = WebServiceTests.GetStringNull("Input"); if (strResult != null) { throw new Exception("Should be null"); } retVal += "GetStringNull: Passed.\r\n"; strResult = WebServiceTests.GetStringCarriageReturn("Carriage\r\nReturn"); if (strResult != "Carriage\r\nReturn-Processed") { throw new Exception("Should be Carriage\r\nReturn-Processed"); } retVal += "GetStringCarriageReturn: Passed.\r\n"; //GetInt int intResult = WebServiceTests.GetInt(1); if (intResult != 2) { throw new Exception("Should be 2"); } retVal += "GetInt: Passed.\r\n"; //GetLong long longResult = WebServiceTests.GetLong(1); if (longResult != 2) { throw new Exception("Should be 2"); } retVal += "GetLong: Passed.\r\n"; //GetVoid WebServiceTests.GetVoid(); retVal += "GetVoid: Passed.\r\n"; //GetBool bool boolResult = WebServiceTests.GetBool(); if (boolResult != true) { throw new Exception("Should be true"); } retVal += "GetBool: Passed.\r\n"; //GetObject Patient pat = WebServiceTests.GetObjectPat(); if (pat.LName != "Smith") { throw new Exception("Should be Smith"); } if (pat.FName != null) { throw new Exception("Should be null"); } retVal += "GetObjectPat: Passed.\r\n"; //GetTable DataTable table = WebServiceTests.GetTable(); if (table.Rows[0][0].ToString() != "cell00") { throw new Exception("Should be cell00"); } retVal += "GetTable: Passed.\r\n"; //GetTable with carriage return table = WebServiceTests.GetTableCarriageReturn(); if (table.Rows[0][0].ToString() != "cell\r\n00") { throw new Exception("Should be cell\r\n00"); } retVal += "GetTableCarriageReturn: Passed.\r\n"; //Get2by3 table = WebServiceTests.GetTable2by3(); for (int i = 0; i < table.Rows.Count; i++) { for (int j = 0; j < table.Columns.Count; j++) { if (table.Rows[i][j].ToString() != "cell" + i.ToString() + j.ToString()) { throw new Exception("Should be cell" + i.ToString() + j.ToString()); } } } retVal += "GetTable2by3: Passed.\r\n"; //GetSpecialChars table = WebServiceTests.GetTableSpecialChars(); char[] chars = { '|', '<', '>', '&', '\'', '"', '\\', '/' }; for (int i = 0; i < table.Rows.Count; i++) { for (int j = 0; j < table.Columns.Count; j++) { if (table.Rows[i][j].ToString() != "cell" + i.ToString() + j.ToString() + chars[i * 2 + j].ToString()) { throw new Exception("Should be cell" + i.ToString() + j.ToString() + chars[i * 2 + j].ToString()); } } } retVal += "GetTableSpecialChars: Passed.\r\n"; //GetDataTypes table = WebServiceTests.GetTableDataTypes(); if (table.Rows[0][0].GetType() != typeof(string)) { throw new Exception("Should be " + typeof(string).ToString()); } if (table.Rows[0][1].GetType() != typeof(decimal)) { throw new Exception("Should be " + typeof(decimal).ToString()); } if (table.Rows[0][2].GetType() != typeof(DateTime)) { throw new Exception("Should be " + typeof(DateTime).ToString()); } retVal += "GetTableDataTypes: Passed.\r\n"; //GetDataSet DataSet ds = WebServiceTests.GetDataSet(); if (ds.Tables[0].TableName != "table0") { throw new Exception("Should be table0"); } retVal += "GetDataSet: Passed.\r\n"; //GetList List <int> listInt = WebServiceTests.GetListInt(); if (listInt[0] != 2) { throw new Exception("Should be 2"); } retVal += "GetListInt: Passed.\r\n"; //GetArrayPatient Patient[] arrayPat = WebServiceTests.GetArrayPatient(); if (arrayPat[0].LName != "Jones") { throw new Exception("Should be Jones"); } if (arrayPat[1] != null) { throw new Exception("Should be null"); } retVal += "GetArrayPatient: Passed.\r\n"; //SendNullParam strResult = WebServiceTests.SendNullParam(null); if (strResult != "nullOK") { throw new Exception("Should be nullOK"); } retVal += "SendNullParam: Passed.\r\n"; //GetObjectNull Patient pat2 = WebServiceTests.GetObjectNull(); if (pat2 != null) { throw new Exception("Should be null"); } retVal += "GetObjectNull: Passed.\r\n"; //SendColorParam Color colorResult = WebServiceTests.SendColorParam(Color.Fuchsia); if (colorResult.ToArgb() != Color.Green.ToArgb()) { throw new Exception("Should be green."); } retVal += "SendColorParam: Passed.\r\n"; //SendProviderColor Provider prov = new Provider(); prov.ProvColor = Color.Fuchsia; strResult = WebServiceTests.SendProviderColor(prov); if (strResult != "fuchsiaOK") { throw new Exception("Should be fuchsiaOK."); } retVal += "SendProviderColor: Passed.\r\n"; //SendSheetParameter SheetParameter sheetParam = new SheetParameter(false, "ParamNameOK"); strResult = WebServiceTests.SendSheetParameter(sheetParam); if (strResult != "paramNameOK") { throw new Exception("Should be paramNameOK."); } retVal += "SendSheetParameter: Passed.\r\n"; //SendSheetWithFields Sheet sheet = new Sheet(); sheet.SheetFields = new List <SheetField>(); sheet.Parameters = new List <SheetParameter>(); SheetField field = new SheetField(); field.FieldName = "FieldNameGreen"; sheet.SheetFields.Add(field); strResult = WebServiceTests.SendSheetWithFields(sheet); if (strResult != "fieldOK") { throw new Exception("Should be fieldOK."); } retVal += "SendSheetWithFields: Passed.\r\n"; //SendSheetDefWithFields SheetDef sheetdef = new SheetDef(); sheetdef.SheetFieldDefs = new List <SheetFieldDef>(); sheetdef.Parameters = new List <SheetParameter>(); SheetFieldDef fielddef = new SheetFieldDef(); fielddef.FieldName = "FieldNameTeal"; sheetdef.SheetFieldDefs.Add(fielddef); strResult = WebServiceTests.SendSheetDefWithFieldDefs(sheetdef); if (strResult != "fielddefOK") { throw new Exception("Should be fielddefOK."); } retVal += "SendSheetDefWithFieldDefs: Passed.\r\n"; //TimeSpanNeg TimeSpan tspan = WebServiceTests.GetTimeSpan(); if (tspan != new TimeSpan(1, 0, 0)) { throw new Exception("Should be 1 hour."); } retVal += "GetTimeSpan: Passed.\r\n"; //GetStringContainingCR strResult = WebServiceTests.GetStringContainingCR(); //strResult=strResult.Replace("\\r","\r"); if (strResult != "Line1\r\nLine2") { throw new Exception("Should be Line1\r\nLine2"); } retVal += "GetStringContainingCR: Passed.\r\n"; /* * //GetListTasksContainingCR * Task task=WebServiceTests.GetListTasksContainingCR()[0]; * if(task.Descript!="Line1\r\nLine2") { * throw new Exception("Should be Line1\r\nLine2"); * } * retVal+="GetListTasksContainingCR: Passed.\r\n";*/ return(retVal); }