/// <summary> /// Verify GET FROM ltblToolboxTabName Table for a valid name /// </summary> /// <param name="name">name from row to do a get on</param> /// <returns>returns the id of this row</returns> private int GetToolboxTabNameForValidNameForMaxID(string name) { getRequest = new ToolBoxItemsListGetRequestDC(); getReply = null; //Populate the request data getRequest.Incaller = IN_CALLER; getRequest.IncallerVersion = IN_CALLER_VERSION; getRequest.InName = name; try { getReply = proxy.ToolboxTabNameGet(getRequest); } catch (FaultException e) { Assert.Fail("Failed to get data from ltblToolboxTabName: {0}", e.Message); } catch (Exception ex) { Assert.Fail("Failed to get data from ltblToolboxTabName: {0}", ex.Message); } Assert.IsNotNull(getReply, "ltblToolboxTabNameGetReplyDC object null"); Assert.IsNotNull(getReply.List, "getReply.List is null"); Assert.AreEqual(1, getReply.List.Count, "Get returned the wrong number of entries. InName: {0}. It should have returned 1 but instead returned {1}.", name, getReply.List.Count); Assert.IsNotNull(getReply.StatusReply, "getReply.StatusReply is null"); int index = getReply.List.Count - 1; int id = getReply.List[index].Id; return id; }
/// <summary> /// Verify GET FROM ltblToolboxTabName Table for softDeleted IDs /// </summary> /// <param name="softDeletedIncode">incode of row to do a get on</param> private void GetToolBoxTabNameForSoftDeletedIDs(int softDeletedIncode) { getRequest = new ToolBoxItemsListGetRequestDC(); // Populate Request getRequest.Incaller = IN_CALLER; getRequest.IncallerVersion = IN_CALLER_VERSION; getRequest.InId = softDeletedIncode; try { getReply = proxy.ToolboxTabNameGet(getRequest); } catch (FaultException ex) { Assert.Fail("Caught WCF FaultExceptionException: Message: {0} \n Stack Trace: {1}", ex.Message, ex.StackTrace); } catch (Exception e) { Assert.Fail("Caught Exception Invoking the Service. Message: {0} \n Stack Trace: {1}", e.Message, e.StackTrace); } int errorConstant = GetErrorConstantSoftDeletedID(); Assert.IsNotNull(getReply, "getReply is null."); Assert.IsNotNull(getReply.StatusReply, "getReply.StatusReply is null"); Assert.AreEqual(0, getReply.List.Count, "Service returned wrong number of records. InId= {0}. It should have returned 0 but instead returned {1}.", softDeletedIncode, getReply.List.Count); Assert.IsNotNull(getReply.StatusReply.ErrorMessage, "Error Message is null"); Assert.AreEqual(errorConstant, getReply.StatusReply.Errorcode, "Service returned unexpected error code. Expected: {0}, Returned: {1}", errorConstant, getReply.StatusReply.Errorcode); }
/// <summary> /// Verify GET FROM ltblToolboxTabName Table for Valid IDs /// </summary> /// <param name="id">id of row to do a get on</param> private void GetToolBoxTabNameForValidIDs(int validID) { getRequest = new ToolBoxItemsListGetRequestDC(); getReply = null; getRequest.Incaller = IN_CALLER; getRequest.IncallerVersion = IN_CALLER_VERSION; getRequest.InId = validID; try { getReply = proxy.ToolboxTabNameGet(getRequest); } catch (FaultException ex) { Assert.Fail("Caught WCF FaultExceptionException: Message: {0} \n Stack Trace: {1}", ex.Message, ex.StackTrace); } catch (Exception e) { Assert.Fail("Caught Exception Invoking the Service. Message: {0} \n Stack Trace: {1}", e.Message, e.StackTrace); } Assert.IsNotNull(getReply, "ToolboxTabNameGetReplyDC object null"); Assert.IsNotNull(getReply.List, "getReply.List is null"); Assert.AreEqual(1, getReply.List.Count, "Get returned the wrong number of entries. It should have returned 1 but instead return {0}", getReply.List.Count); Assert.IsNotNull(getReply.StatusReply, "getReply.StatusReply is null"); Assert.AreEqual(getRequest.InId, getReply.List[0].Id, "Service returned the wrong record"); }
/// <summary> /// Verify GET FROM ltblToolboxTabName Table for Invalid IDs /// </summary> /// <param name="nonExistingID">id of row to do a get on</param> private void GetToolBoxTabNameForInValidIDs(int inValidID) { bool isFaultException = false; getRequest = new ToolBoxItemsListGetRequestDC(); getReply = null; getRequest.Incaller = IN_CALLER; getRequest.IncallerVersion = IN_CALLER_VERSION; getRequest.InId = inValidID; try { getReply = proxy.ToolboxTabNameGet(getRequest); } // Task 20943. Add fault exception validation. //catch (FaultException<www.microsoft.com.practices.EnterpriseLibrary._2007._01.wcf.validation.ValidationFault> exc) //{ // if (getRequest.InId < 0) // { // Assert.IsNotNull(exc.Detail.Details); // Assert.AreEqual(1, exc.Detail.Details.Count); // Assert.IsNotNull(exc.Detail.Details[0].Message); // Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_INID_MSG, exc.Detail.Details[0].Message); // isFaultException = true; // } // else // { // Assert.Fail("Failed to get data from ltblToolboxTabName: {0}", exc.Message); // } //} catch (FaultException ex) { Assert.Fail("Caught WCF FaultExceptionException: Message: {0} \n Stack Trace: {1}", ex.Message, ex.StackTrace); } catch (Exception e) { Assert.Fail("Caught Exception Invoking the Service. Message: {0} \n Stack Trace: {1}", e.Message, e.StackTrace); } if (!isFaultException) { int errorConstant = GetErrorConstantInvalidID(inValidID); Assert.IsNotNull(getReply, "getReply is null."); Assert.IsNotNull(getReply.StatusReply, "getReply.StatusReply is null"); Assert.AreEqual(0, getReply.List.Count, "Service returned wrong number of records. InId= {0}. It should have returned 0 but instead returned {1}.", inValidID, getReply.List.Count); Assert.IsNotNull(getReply.StatusReply.ErrorMessage, "Error Message is null"); Assert.AreEqual(errorConstant, getReply.StatusReply.Errorcode, "Service returned unexpected error code: {0}. It should have returned {1}", getReply.StatusReply.Errorcode, errorConstant); } }