Exemplo n.º 1
0
        /// <summary>
        /// Verify CreateOrUpdate FROM ltblAuthGroup 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 CreateOrUpdateAuthGroupsForInvalidId(int id, string name)
        {
            bool isFaultException = false;

            createOrUpdateRequest = new AuthGroupsCreateOrUpdateRequestDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.InId = id;
            createOrUpdateRequest.InGuid = Guid.NewGuid();
            createOrUpdateRequest.InName = name;
            createOrUpdateRequest.InInsertedByUserAlias = USER;
            createOrUpdateRequest.InUpdatedByUserAlias = USER;

            try
            {
                createOrUpdateReply = proxy.AuthGroupsCreateOrUpdate(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.AreNotEqual(0, 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.InName == null || createOrUpdateRequest.InName == string.Empty)
            //        {
            //            Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_INNAME_MSG, exc.Detail.Details[0].Message);
            //            isFaultException = true;
            //        }
            //        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 (createOrUpdateRequest.InGuid == null)
            //        {
            //            Assert.AreEqual(CWF.Constants.SprocValues.INVALID_PARMETER_VALUE_INGUID_MSG, exc.Detail.Details[0].Message);
            //            isFaultException = true;
            //        }
            //    }
            //    if (!isFaultException)
            //    {
            //        Assert.Fail("Failed to get data from ltblAuthGroups {0}", exc.Message);
            //    }
            //}
            catch (FaultException e)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblAuthGroups: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to createOrUpdate data from ltblAuthGroups: {0}", ex.Message);
            }

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

                Assert.IsNotNull(createOrUpdateReply, "AuthGroupsCreateOrUpdateReplyDC object null");
                Assert.IsNotNull(createOrUpdateReply.StatusReply, "createOrUpdateReply.StatusReply is null");
                Assert.AreEqual(createOrUpdateReply.StatusReply.Errorcode, errorConstant, "createOrUpdateReply.StatusReply.Errorcode is not {0}. Instead it is {1}.", errorConstant, createOrUpdateReply.StatusReply.Errorcode);
                Assert.IsNotNull(createOrUpdateReply.StatusReply.ErrorMessage, "createOrUpdateReply.StatusReply.ErrorMessage is null");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Verify CreateOrUpdate FROM ltblAuthGroup 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 CreateOrUpdateAuthGroupsWithNullId(string name)
        {
            createOrUpdateRequest = new AuthGroupsCreateOrUpdateRequestDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.InGuid = Guid.NewGuid();
            createOrUpdateRequest.InName = name;
            createOrUpdateRequest.InInsertedByUserAlias = USER;
            createOrUpdateRequest.InUpdatedByUserAlias = USER;

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

            Assert.IsNotNull(createOrUpdateReply, "AuthGroupsCreateOrUpdateReplyDC 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 = GetAuthGroupForValidNameForMaxID(name);
            GetAuthGroupForValidIDs(id);
            Assert.IsNotNull(getReply, "getReplyList is null.");
            Assert.IsNotNull(getReply.List, "getReplyList is null.");
            Assert.AreNotEqual(0, getReply.List.Count, " getReply.List.Count is 0.");
            Assert.AreEqual(name, getReply.List[0].Name, "Name did not get inserted or updated correctly");

            return id;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Verify CreateOrUpdate FROM ltblAuthGroup 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 CreateOrUpdateAuthGroups(int id, string name)
        {
            createOrUpdateRequest = new AuthGroupsCreateOrUpdateRequestDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.InId = id;
            createOrUpdateRequest.InGuid = Guid.NewGuid();
            createOrUpdateRequest.InName = name;
            createOrUpdateRequest.InInsertedByUserAlias = USER;
            createOrUpdateRequest.InUpdatedByUserAlias = USER;

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

            Assert.IsNotNull(createOrUpdateReply, "AuthGroupsCreateOrUpdateReplyDC 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");
        }