Example #1
0
        /// <summary>
        /// Verify GET FROM ltblAuthGroup 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 GetAuthGroupForValidNameForMaxID(string name)
        {
            getRequest = new AuthGroupsGetRequestDC();

            // Populate Request
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;

            getRequest.InName = name;

            try
            {
                getReply = proxy.AuthGroupsGet(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);
            }

            // Validate
            Assert.IsNotNull(getReply, "getReply is null.");
            Assert.IsNotNull(getReply.StatusReply, "getReply.StatusReply is null");
            Assert.AreEqual(1, getReply.List.Count, "Service returned wrong number of records.inName = {0}. It should have returned 1 but instead returned {1}.", name, getReply.List.Count);
            Assert.IsNull(getReply.StatusReply.ErrorMessage, "Error Message is not null. Error Message: {0}", getReply.StatusReply.ErrorMessage);
            Assert.IsNull(getReply.StatusReply.ErrorGuid, "ErrorGuid is not null. ErrorGuid: {0}", getReply.StatusReply.ErrorGuid);

            int index = getReply.List.Count - 1;
            int id = getReply.List[index].Id;
            return id;
        }
Example #2
0
        /// <summary>
        /// Verify GET FROM ltblAuthGroup Table for softDeleted IDs
        /// </summary>
        /// <param name="softDeletedID">id of row to do a get on</param>
        private void GetAuthGroupForSoftDeletedIDs(int softDeletedID)
        {
            getRequest = new AuthGroupsGetRequestDC();

            // Populate Request
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;
            getRequest.InId = softDeletedID;

            try
            {
                getReply = proxy.AuthGroupsGet(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}.", softDeletedID, 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);
        }
Example #3
0
        /// <summary>
        /// Verify GET FROM ltblAuthGroup Table for Valid IDs
        /// </summary>
        /// <param name="id">id of row to do a get on</param>
        private void GetAuthGroupForValidIDs(int id)
        {
            getRequest = new AuthGroupsGetRequestDC();

            // Populate Request
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;

            getRequest.InId = id;

            try
            {
                getReply = proxy.AuthGroupsGet(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);
            }

            // Validate
            Assert.IsNotNull(getReply, "getReply is null.");
            Assert.IsNotNull(getReply.StatusReply, "getReply.StatusReply is null");
            Assert.AreEqual(1, getReply.List.Count, "Service returned wrong number of records.InId = {0}. It should have returned 1 but instead returned {1}.", id, getReply.List.Count);
            Assert.IsNull(getReply.StatusReply.ErrorMessage, "Error Message is not null. Error Message: {0}", getReply.StatusReply.ErrorMessage);
            Assert.IsNull(getReply.StatusReply.ErrorGuid, "ErrorGuid is not null. ErrorGuid: {0}", getReply.StatusReply.ErrorGuid);
            Assert.AreEqual(getReply.List[0].Id, getRequest.InId, "Service returned the wrong record. Expected Id: {0}, Actual Id: {1}", getRequest.InId, getReply.List[0].Id);
        }
Example #4
0
        /// <summary>
        /// Verify GET FROM ltblAuthGroup Table for Invalid IDs
        /// </summary>
        /// <param name="nonExistingID">id of row to do a get on</param>
        private void GetAuthGroupForInValidIDs(int nonExistingID)
        {
            bool isFaultException = false;

            getRequest = new AuthGroupsGetRequestDC();

            // Populate Request
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;
            getRequest.InId = nonExistingID;

            try
            {
                getReply = proxy.AuthGroupsGet(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 ltblActivityCategory: {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(nonExistingID);

                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}.", nonExistingID, 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);
            }
        }