/// <summary>
        /// Performs input validation and gets activities by activity library ID or Name & Version combination.
        /// </summary>
        /// <param name="request">Request that specifies activity library identifier info.</param>
        /// <param name="includeXaml">Flag that indicates whether activity XAML should be returned.</param>
        /// <returns>Response that contains a list of activities.</returns>
        public static GetActivitiesByActivityLibraryNameAndVersionReplyDC GetActivitiesByActivityLibrary(GetActivitiesByActivityLibraryNameAndVersionRequestDC request, bool includeXaml)
        {
            var reply = new GetActivitiesByActivityLibraryNameAndVersionReplyDC();

            try
            {
                // Validates the input and throws ValidationException for any issues found.
                request.ValidateRequest();

                var newRequest = new GetLibraryAndActivitiesDC();
                var activityLibraryDC = new ActivityLibraryDC();
                var newReply = new List<GetLibraryAndActivitiesDC>();

                activityLibraryDC.IncallerVersion = request.IncallerVersion;
                activityLibraryDC.Incaller = request.Incaller;
                activityLibraryDC.Name = request.Name;
                activityLibraryDC.VersionNumber = request.VersionNumber;
                newRequest.ActivityLibrary = activityLibraryDC;

                newReply = ActivityRepositoryService.GetActivitiesByActivityLibrary(newRequest, includeXaml);

                if (newReply != null && newReply.Count > 0)
                {
                    reply.List = newReply[0].StoreActivitiesList;
                }
            }
            catch (ValidationException e)
            {
                e.HandleException();
            }
            catch (DataAccessException e)
            {
                e.HandleException();
            }

            return reply;
        }
        /// <summary>
        /// Verify GetActivitiesByActivityLibraryNameAndVersion FROM etblActivityLibraries Table
        /// </summary>
        /// <param name="name">name to do a get on</param>
        /// <param name="version">version to do a get on</param>
        private void VerifyGetActivitiesByActivityLibraryNameAndVersion(string name, string version)
        {
            getActivitiesByActivityLibraryNameAndVersionRequestDC = new GetActivitiesByActivityLibraryNameAndVersionRequestDC();
            getActivitiesByActivityLibraryNameAndVersionReplyDC = null;

            //Populate the request data
            getActivitiesByActivityLibraryNameAndVersionRequestDC.Incaller = IN_CALLER;
            getActivitiesByActivityLibraryNameAndVersionRequestDC.IncallerVersion = IN_CALLER_VERSION;
            getActivitiesByActivityLibraryNameAndVersionRequestDC.InInsertedByUserAlias = USER;
            getActivitiesByActivityLibraryNameAndVersionRequestDC.InUpdatedByUserAlias = USER;
            getActivitiesByActivityLibraryNameAndVersionRequestDC.Name = name;
            getActivitiesByActivityLibraryNameAndVersionRequestDC.VersionNumber = version;

            try
            {
                getActivitiesByActivityLibraryNameAndVersionReplyDC = devBranchProxy.GetActivitiesByActivityLibraryNameAndVersion(getActivitiesByActivityLibraryNameAndVersionRequestDC);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", ex.Message);
            }

            Assert.IsNotNull(getActivitiesByActivityLibraryNameAndVersionReplyDC, "getActivitiesByActivityLibraryNameAndVersionReplyDC is null");
            Assert.IsNotNull(getActivitiesByActivityLibraryNameAndVersionReplyDC.StatusReply, "getActivityLibrariesByNameReply.StatusReply is null");
            Assert.AreEqual(0, getActivitiesByActivityLibraryNameAndVersionReplyDC.StatusReply.Errorcode, "StatusReply returned the wrong error code. Expected: 0. Actual: {0}", getActivitiesByActivityLibraryNameAndVersionReplyDC.StatusReply.Errorcode);
            Assert.IsNotNull(getActivitiesByActivityLibraryNameAndVersionReplyDC.List, "getActivitiesByActivityLibraryNameAndVersionReplyDC.List is null");
            Assert.AreNotEqual(0, getActivitiesByActivityLibraryNameAndVersionReplyDC.List.Count, "getActivitiesByActivityLibraryNameAndVersionReplyDC.List is empty");
            Assert.AreEqual(name, getActivitiesByActivityLibraryNameAndVersionReplyDC.List[0].ActivityLibraryName, "Reply returned the wrong ActivityLibraryName");
        }
Example #3
0
        public void UnitTestBalGetActivitiesByActivityLibraryNameAndVersion()
        {
            var request = new CWF.DataContracts.GetActivitiesByActivityLibraryNameAndVersionRequestDC();
            var reply = new CWF.DataContracts.GetActivitiesByActivityLibraryNameAndVersionReplyDC();

            request.Incaller = INCALLER;
            request.IncallerVersion = INCALLERVERSION;
            request.Name = "OASP.Activities";
            request.VersionNumber = "2.2.108.0";

            try
            {
                reply = ActivityBusinessService.GetActivitiesByActivityLibrary(request, true);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch (Exception ex) on reply = CWF.BAL.StoreActivityLibraryDependencies.StoreActivityLibraryDependencyList(request);");
            }

            Assert.AreEqual(reply.StatusReply.Errorcode, 0);
            Assert.AreEqual(reply.StatusReply.ErrorMessage, string.Empty);
        }