Exemplo n.º 1
0
        public void SetTheEnvironenmentToTheSessionStateIfNotNull()
        {
            Isolate.WhenCalled(() => _sessionState[SessionStateManager.EnvironmentSetting]).WillReturn("Test");

            SessionStateManager.SetEnvironment("Test", _sessionState);

            Isolate.Verify.WasCalledWithAnyArguments(() => _sessionState[SessionStateManager.EnvironmentSetting] = null);
            Assert.AreEqual("Test", SessionStateManager.GetEnvironment(_sessionState));
        }
Exemplo n.º 2
0
        public override void OnActionExecuting(
            ActionExecutingContext filterContext)
        {
            var sessionState = filterContext.HttpContext.Session;

            SessionStateManager.UseSessionFactoryFromApplicationOrSessionState(sessionState);

            OpenSession(sessionState);
            BindSessionToCurrentSessionContext();
        }
Exemplo n.º 3
0
        public ActionResult Login(string Username, string Password)
        {
            SessionStateManager.LogIn();             // TODO - REMOVE!!
            if (Username != null && Password != null)
            {
                if (Username == "steve" && Password == "test")
                {
                    SessionStateManager.LogIn();
                }
            }

            return(View("Index"));
        }
        private void LoadData()
        {
            var provider = SessionStateManager.GetProvider(SessionStateProviderName);

            Verify.IsTrue(provider.TryGetState(StateId, out _state), "Failed to get session state");

            var parameters  = _state.Parameters;
            var typeOptions = _state.ParameterTypeOptions;

            Verify.IsNotNull(parameters, "Failed to get 'Parameters' binding from related workflow");
            Verify.IsNotNull(typeOptions, "Failed to get 'ParameterTypeOptions' binding from related workflow");

            Parameters  = new List <ManagedParameterDefinition>(parameters);
            TypeOptions = new List <Type>(typeOptions);
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (CurrentlySelectedFieldId != Guid.Empty)
            {
                var defaultFunction = StandardFunctions.GetDefaultFunctionByType(this.CurrentlySelectedType);

                btnDefaultValueFunctionMarkup.Attributes["label"] = GetString(btnDefaultValueFunctionMarkup.Value.IsNullOrEmpty() ? "DefaultValueSpecify" : "DefaultValueEdit");
                btnDefaultValueFunctionMarkup.Attributes["url"]   =
                    "${root}/content/dialogs/functions/editFunctionCall.aspx?type=" + this.CurrentlySelectedType.FullName +
                    "&dialoglabel=" + HttpUtility.UrlEncodeUnicode(GetString("DefaultValueDialogLabel")) + "&multimode=false&functionmarkup=";


                btnTestValueFunctionMarkup.Attributes["label"] = GetString(btnTestValueFunctionMarkup.Value.IsNullOrEmpty() ? "TestValueSpecify" : "TestValueEdit");
                btnTestValueFunctionMarkup.Attributes["url"]   =
                    "${root}/content/dialogs/functions/editFunctionCall.aspx?type=" + this.CurrentlySelectedType.FullName +
                    "&dialoglabel=" + HttpUtility.UrlEncodeUnicode(GetString("TestValueDialogLabel")) + "&multimode=false&functionmarkup=";

                btnWidgetFunctionMarkup.Attributes["label"] = CurrentlySelectedWidgetText;
                btnWidgetFunctionMarkup.Attributes["url"]   =
                    "${root}/content/dialogs/functions/editFunctionCall.aspx?functiontype=widget&type=" + this.CurrentlySelectedWidgetReturnType.FullName +
                    "&dialoglabel=" + HttpUtility.UrlEncodeUnicode(GetString("WidgetDialogLabel")) + "&multimode=false&functionmarkup=";

                if (defaultFunction != null)
                {
                    string defaultValue = new FunctionRuntimeTreeNode(defaultFunction).Serialize().ToString();

                    btnDefaultValueFunctionMarkup.DefaultValue = defaultValue;
                    btnTestValueFunctionMarkup.DefaultValue    = defaultValue;
                }
            }

            btnDelete.Attributes["isdisabled"] = CurrentlySelectedFieldId == Guid.Empty ? "true" : "false";

            if (nameChanged)
            {
                UpdateFieldsPanel();
            }

            _state.Parameters = this.CurrentFields.ToList();
            SessionStateManager.GetProvider(SessionStateProviderName).SetState(StateId, _state, DateTime.Now.AddDays(7.0));
        }
        public void MyTestInitialize()
        {
            _sessionState = Isolate.Fake.Instance <HttpSessionStateBase>();
            ObjectFactory.Configure(x => x.For <HttpSessionStateBase>().Use(_sessionState));
            _controller = ObjectFactory.GetInstance <LoginController>();

            Isolate.WhenCalled(() => EnvironmentServices.SetEnvironment("Test")).IgnoreCall();
            Isolate.WhenCalled(() => SessionStateManager.InitializeDatabase(_sessionState)).IgnoreCall();

            _user = new UserLoginDto
            {
                UserName    = "******",
                Password    = "******",
                Environment = Testgenform
            };
            Isolate.WhenCalled(() => LoginServices.Login(_user)).IgnoreCall();

            _response = Isolate.Fake.Instance <HttpResponseBase>();
            Isolate.WhenCalled(() => _controller.Response).WillReturn(_response);

            _context = Isolate.Fake.Instance <HttpContextBase>();
            Isolate.WhenCalled(() => _controller.HttpContext).WillReturn(_context);
            Isolate.WhenCalled(() => _context.Session).WillReturn(_sessionState);
        }
        private static async Task <long> ProcessNextMessagesWithSessionStateAsync(SubscriptionClient client, IMessageSession session, SessionStateManager session_state, int EndOfSessionCount, ConsoleColor color)
        {
            int x = session_state.LastProcessedCount + 1;

            long seq2 = 0;

            if (session_state.DeferredList.TryGetValue(x, out long seq1))
            {
                while (true)
                {
                    if (!session_state.DeferredList.TryGetValue(x, out seq2))
                    {
                        break;
                    }

                    //-------------------------------
                    var deferredMessage = await session.ReceiveDeferredMessageAsync(seq2);

                    if (ProcessMessages(deferredMessage, Color.White))
                    {
                        await session.CompleteAsync(deferredMessage.SystemProperties.LockToken);

                        session_state.LastProcessedCount = ((int)deferredMessage.UserProperties["Count"]);
                        session_state.DeferredList.Remove(x);
                        await session.SetStateAsync(Utils.Serialize <SessionStateManager>(session_state));
                    }
                    else
                    {
                        await client.DeadLetterAsync(deferredMessage.SystemProperties.LockToken, "Message is of the wrong type", "Cannot deserialize this message as the type in the Label prop is unknown.");

                        session_state.DeferredList.Remove(x);
                        await session.SetStateAsync(Utils.Serialize <SessionStateManager>(session_state));
                    }

                    //------------------------------

                    x++;
                }
            }

            return(seq2);
        }
Exemplo n.º 8
0
 private void OpenSession(HttpSessionStateBase sessionState)
 {
     _session = SessionStateManager.OpenSession(sessionState);
 }
Exemplo n.º 9
0
 public void GetTheDefaultTestGenFormEnvironmentIfNoEnvironmentInSessionState()
 {
     Assert.AreEqual("TestGenForm", SessionStateManager.GetEnvironment(_sessionState));
 }
Exemplo n.º 10
0
        public void GetTheEnvironmentFromTheSessionStateIfSet()
        {
            Isolate.WhenCalled(() => _sessionState[SessionStateManager.EnvironmentSetting]).WillReturn("Test");

            Assert.AreEqual("Test", SessionStateManager.GetEnvironment(_sessionState));
        }
Exemplo n.º 11
0
        public void GetTheSessionFactoryFromTheSessionStateIfNotNull()
        {
            Isolate.WhenCalled(() => _sessionState[SessionStateManager.SessionFactorySetting]).WillReturn(_factory);

            Assert.AreEqual(_factory, SessionStateManager.GetSessionFactoryFromSessionState(_sessionState));
        }
Exemplo n.º 12
0
        public void GetTheConnectionFromHttpSessionStateIfNotNull()
        {
            Isolate.WhenCalled(() => _sessionState[SessionStateManager.ConnectionSetting]).WillReturn(_connection);

            Assert.AreEqual(_connection, SessionStateManager.GetConnectionFromSessionState(_sessionState));
        }