Пример #1
0
        /// <summary>
        /// Verify CreateOrUpdate FROM ltblToolboxTabName Table for Invalid IDs. id is invalid if it's not 0 or not already in the table.
        /// </summary>
        /// <param name="id">id to try to insert or update</param>
        /// <param name="name">name to try to insert or update</param>
        private void CreateOrUpdateToolBoxTabNameForInvalidId(int id, string name)
        {
            bool isFaultException = false;

            createOrUpdateRequest = new ToolBoxTabNameCreateOrUpdateRequestDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.InId = id;
            createOrUpdateRequest.InTabName = name;
            createOrUpdateRequest.InInsertedByUserAlias = USER;
            createOrUpdateRequest.InUpdatedByUserAlias = USER;

            try
            {
                createOrUpdateReply = proxy.ToolBoxTabNameCreateOrUpdate(createOrUpdateRequest);
            }
            // 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 (createOrUpdateRequest.InId < 0)
            //    {
            //        Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_INID_MSG, exc.Detail.Details[0].Message);
            //        isFaultException = true;
            //    }
            //    else if (createOrUpdateRequest.InId == 0)
            //    {
            //        if (createOrUpdateRequest.InTabName == null || createOrUpdateRequest.InTabName == string.Empty)
            //        {
            //            Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_INNAME_MSG, exc.Detail.Details[0].Message);
            //            isFaultException = true;
            //        }
            //        else if (createOrUpdateRequest.InInsertedByUserAlias == null || createOrUpdateRequest.InInsertedByUserAlias == string.Empty)
            //        {
            //            Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_ININSERTEDBYUSERALIAS_MSG, exc.Detail.Details[0].Message);
            //            isFaultException = true;
            //        }
            //    }
            //    if (!isFaultException)
            //    {
            //        Assert.Fail("Failed to get data from ltblToolboxTabName: {0}", exc.Message);
            //    }
            //}
            catch (FaultException e)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblToolboxTabName: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblToolboxTabName: {0}", ex.Message);
            }

            if (!isFaultException)
            {
                int errorConstant = GetErrorConstantInvalidIDForUpdate(id);

                Assert.IsNotNull(createOrUpdateReply, "ToolBoxTabNameCreateOrUpdateRequestDC object null");
                Assert.IsNotNull(createOrUpdateReply.StatusReply, "createOrUpdateReply.Status is null");
                Assert.AreEqual(errorConstant, createOrUpdateReply.StatusReply.Errorcode, "Returned the wrong status error code. InId: {0}", id);
                Assert.IsNotNull(createOrUpdateReply.StatusReply.ErrorMessage, "createOrUpdateReply.StatusReply.ErrorMessage is null");
            }
        }
Пример #2
0
        /// <summary>
        /// Verify CreateOrUpdate FROM ltblToolboxTabName Table. This will be a create since id is null.
        /// </summary>
        /// <param name="name">name to be created</param>
        /// <returns>returns the id created</returns>
        private int CreateToolboxTabNameWithNullID(string name)
        {
            createOrUpdateRequest = new ToolBoxTabNameCreateOrUpdateRequestDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.InTabName = name;
            createOrUpdateRequest.InInsertedByUserAlias = USER;
            createOrUpdateRequest.InUpdatedByUserAlias = USER;

            try
            {
                createOrUpdateReply = proxy.ToolBoxTabNameCreateOrUpdate(createOrUpdateRequest);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblToolboxTabName: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblToolboxTabName: {0}", ex.Message);
            }

            Assert.IsNotNull(createOrUpdateReply, "ToolBoxTabNameCreateOrUpdateReplyDC object null");
            Assert.IsNotNull(createOrUpdateReply.StatusReply, "createOrUpdateReply.StatusReply is null");
            Assert.AreEqual(0, createOrUpdateReply.StatusReply.Errorcode, "createOrUpdateReply.StatusReply.Errorcode is not 0. Instead it is {0}.", createOrUpdateReply.StatusReply.Errorcode);
            Assert.IsNull(createOrUpdateReply.StatusReply.ErrorMessage, "createOrUpdateReply.StatusReply.ErrorMessage is not null");
            Assert.IsNull(createOrUpdateReply.StatusReply.ErrorGuid, "createOrUpdateReply.StatusReply.ErrorGuid is not null");

            int id = GetToolboxTabNameForValidNameForMaxID(name);
            GetToolBoxTabNameForValidIDs(id);
            Assert.AreEqual(name, getReply.List[0].Name, "Name did not get inserted or updated corrected");

            return id;
        }
Пример #3
0
        /// <summary>
        /// Verify CreateOrUpdate FROM ltblToolboxTabName Table
        /// </summary>
        /// <param name="id"> id to do a create or update on. id is 0 if it will be a create.</param>
        /// <param name="name">name to do a create or update on.</param>
        private void CreateOrUpdateToolBoxTabName(int id, string name)
        {
            createOrUpdateRequest = new ToolBoxTabNameCreateOrUpdateRequestDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.InId = id;
            createOrUpdateRequest.InTabName = name;
            createOrUpdateRequest.InInsertedByUserAlias = USER;
            createOrUpdateRequest.InUpdatedByUserAlias = USER;

            try
            {
                createOrUpdateReply = proxy.ToolBoxTabNameCreateOrUpdate(createOrUpdateRequest);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblToolboxTabName: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblToolboxTabName: {0}", ex.Message);
            }

            Assert.IsNotNull(createOrUpdateReply, "ToolBoxTabNameCreateOrUpdateReplyDC object null");
            Assert.IsNotNull(createOrUpdateReply.StatusReply, "createOrUpdateReply.StatusReply is null");
            Assert.AreEqual(0, createOrUpdateReply.StatusReply.Errorcode, "createOrUpdateReply.StatusReply.Errorcode is not 0. Instead it is {0}.", createOrUpdateReply.StatusReply.Errorcode);
            Assert.IsNull(createOrUpdateReply.StatusReply.ErrorMessage, "createOrUpdateReply.StatusReply.ErrorMessage is not null");
            Assert.IsNull(createOrUpdateReply.StatusReply.ErrorGuid, "createOrUpdateReply.StatusReply.ErrorGuid is not null");
        }