Пример #1
0
        /// <summary>
        /// Mock Session : Windows job doesn't
        /// </summary>
        private void MockSession()
        {
            #region Mock

            _webContext = new MockWebOperationContext();
            var userProp = new UserBusinessEntity {
                UserGUID = _mCreatedBy
            };
            //Mock HttpContext & HttpSession : Calling from Worker so doesn't contain HttpContext.
            var mockContext = new Mock <HttpContextBase>();
            var mockSession = new Mock <HttpSessionStateBase>();
            if (_mUserProp != null)
            {
                userProp = _mUserProp;
            }
            else
            {
                _mUserProp = UserBO.AuthenticateUsingUserGuid(_mCreatedBy);
                userProp   = _mUserProp;
            }
            var userSession = new UserSessionBEO();
            SetUserSession(userProp, userSession);
            mockSession.Setup(ctx => ctx["UserDetails"]).Returns(userProp);
            mockSession.Setup(ctx => ctx["UserSessionInfo"]).Returns(userSession);
            mockSession.Setup(ctx => ctx.SessionID).Returns(Guid.NewGuid().ToString());
            mockContext.Setup(ctx => ctx.Session).Returns(mockSession.Object);
            EVHttpContext.CurrentContext = mockContext.Object;

            #endregion
        }
Пример #2
0
        //Key : Newly generated Id during overlay
        //Value : Id generated earlier(during Append)
        #endregion

        #region OverDrive

        protected override void BeginWork()
        {
            base.BeginWork();
            _jobParameter = GetImportBEO(BootParameters);

            if (_jobParameter != null && !string.IsNullOrEmpty(_jobParameter.CreatedBy))
            {
                //Get User Information , Its needed for search
                _userInfo            = UserBO.AuthenticateUsingUserGuid(_jobParameter.CreatedBy);
                _userInfo.CreatedBy  = _jobParameter.CreatedBy;
                _isIncludeNativeFile = (_jobParameter != null && _jobParameter.IsImportNativeFiles);
            }
        }
        private IWebOperationContext EstablishSession(string createdBy)
        {
            var userProp = new UserBusinessEntity {
                UserGUID = createdBy
            };
            //Mock HttpContext & HttpSession : Calling from Worker so doesn't contain HttpContext.
            var mockContext = new Mock <HttpContextBase>();
            var mockSession = new Mock <HttpSessionStateBase>();

            userProp = UserBO.AuthenticateUsingUserGuid(createdBy);
            var userSession = new UserSessionBEO();

            SetUserSession(createdBy, userProp, userSession);
            mockSession.Setup(ctx => ctx["UserDetails"]).Returns(userProp);
            mockSession.Setup(ctx => ctx["UserSessionInfo"]).Returns(userSession);
            mockSession.Setup(ctx => ctx.SessionID).Returns(Guid.NewGuid().ToString());
            mockContext.Setup(ctx => ctx.Session).Returns(mockSession.Object);
            EVHttpContext.CurrentContext = mockContext.Object;
            return(new MockWebOperationContext().Object);
        }
        /// <summary>
        /// Mock Session : Windows job doesn't
        /// </summary>
        private static void MockSession(string createdBy)
        {
            #region Mock

            //MockWebOperationContext webContext = new MockWebOperationContext(createdBy);

            //Mock HttpContext & HttpSession : Calling from Worker so doesn't contain HttpContext.
            var mockContext = new Mock <HttpContextBase>();
            var mockSession = new Mock <HttpSessionStateBase>();

            var userProp = UserBO.AuthenticateUsingUserGuid(createdBy);
            userProp.UserGUID = createdBy;
            var userSession = new UserSessionBEO();
            SetUserSession(userProp, userSession);
            mockSession.Setup(ctx => ctx["UserDetails"]).Returns(userProp);
            mockSession.Setup(ctx => ctx["UserSessionInfo"]).Returns(userSession);
            mockSession.Setup(ctx => ctx.SessionID).Returns(Guid.NewGuid().ToString());
            mockContext.Setup(ctx => ctx.Session).Returns(mockSession.Object);
            EVHttpContext.CurrentContext = mockContext.Object;

            #endregion
        }
Пример #5
0
        protected override void BeginWork()
        {
            try
            {
                base.BeginWork();
                _jobParams = GetImportBEO(BootParameters);

                if (_jobParams != null && !string.IsNullOrEmpty(_jobParams.CreatedBy))
                {
                    //Get User Information , Its needed for search
                    _userInfo            = UserBO.AuthenticateUsingUserGuid(_jobParams.CreatedBy);
                    _userInfo.CreatedBy  = _jobParams.CreatedBy;
                    _isIncludeNativeFile = (_jobParams.IsImportNative);
                }
                //Law import batch size for documents
                _batchSize = GetMessageBatchSize();
            }
            catch (Exception ex)
            {
                ReportToDirector(ex.ToUserString());
                ex.Trace().Swallow();
            }
        }