/// <summary> /// Verify DELETE FROM ltblContextCategories Table for Valid Name. Will set softdelete to 1. /// </summary> /// <param name="name">name of row to do a delete on</param> /// <returns>returns the id of this row</returns> private int DeleteContextCategoriesForValidNames(string name) { int id = GetContextCategoriesForValidNamesForMaxID(name); deleteRequest = new ContextCategoriesDeleteRequestDC(); deleteReply = null; deleteRequest.Incaller = IN_CALLER; deleteRequest.IncallerVersion = IN_CALLER_VERSION; deleteRequest.InName = name; try { deleteReply = proxy.ContextCategoriesDelete(deleteRequest); } catch (FaultException e) { Assert.Fail("Failed to delete data from ltblContextCategories: {0}", e.Message); } catch (Exception ex) { Assert.Fail("Failed to delete data from ltblContextCategories: {0}", ex.Message); } Assert.IsNotNull(deleteReply, "etblContextDeleteReplyDC object null"); Assert.IsNotNull(deleteReply.StatusReply, "deleteReply.StatusReply is null"); Assert.AreEqual(0, deleteReply.StatusReply.Errorcode, "Delete operation not successful."); // Now check to see if we don't have that record in the table GetContextCategoriesForSoftDeletedID(id); return id; }
/// <summary> /// Verify DELETE FROM ltblContextCategories Table for Invalid IDs /// </summary> /// <param name="id">id of row to do a delete on. This id does not exist in the table</param> private void DeleteContextCategoriesForInvalidIDs(int id) { bool isFaultException = false; deleteRequest = new ContextCategoriesDeleteRequestDC(); deleteReply = null; deleteRequest.Incaller = IN_CALLER; deleteRequest.IncallerVersion = IN_CALLER_VERSION; deleteRequest.InId = id; try { deleteReply = proxy.ContextCategoriesDelete(deleteRequest); } // Task 20943. Add fault exception validation. //catch (FaultException<www.microsoft.com.practices.EnterpriseLibrary._2007._01.wcf.validation.ValidationFault> exc) //{ // Assert.IsNotNull(exc.Detail.Details); // Assert.AreEqual(1, exc.Detail.Details.Count); // Assert.IsNotNull(exc.Detail.Details[0].Message); // if (deleteRequest.InId < 0) // { // Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_INID_MSG, exc.Detail.Details[0].Message); // isFaultException = true; // } // else if ((deleteRequest.InId == 0) && (deleteRequest.InGuid == null || deleteRequest.InGuid.CompareTo(Guid.Empty) == 0) && (deleteRequest.InName == null || deleteRequest.InName == string.Empty)) // { // Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_InIdInNameInGuidCannotAllBeNull_MSG, exc.Detail.Details[0].Message); // isFaultException = true; // } // else // { // Assert.Fail("Failed to delete data from ltblContextCategories: {0}", exc.Message); // } //} catch (FaultException e) { Assert.Fail("Failed to delete data from ltblContextCategories: {0}", e.Message); } catch (Exception ex) { Assert.Fail("Failed to delete data from ltblContextCategories: {0}", ex.Message); } if (!isFaultException) { int errorcode = GetErrorConstantDeleteInvalidID(id); // special case if id = 0 if (id == 0) { errorcode = CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_INIDINNAMEINGUIDCANNOTALLBENULL_ID; } Assert.IsNotNull(deleteReply, "ContextCategoriesGetReplyDC object null"); Assert.IsNotNull(deleteReply.StatusReply, "deleteReply.StatusReply is null"); Assert.AreEqual(errorcode, deleteReply.StatusReply.Errorcode, "Delete operation not successful."); Assert.IsNotNull(deleteReply.StatusReply.ErrorMessage, "Error Message is null"); } }