Beispiel #1
0
        public void SessionValues_CanGetKeys()
        {
            lock (TestOrderingLock.Lock)
            {
                var wa = new WebApplicationEngine();

                var checks  = new Dictionary <string, byte[]>();
                var session = CreateSessionMock(checks);

                var oscriptSession = new SessionImpl(session);
                oscriptSession.SetString("user", "EvilBeaver");
                oscriptSession.SetString("password", "1");

                var arr = oscriptSession.GetKeys();
                Assert.Equal(2, arr.Count());
                Assert.NotEqual(arr.Find(ValueFactory.Create("user")), ValueFactory.Create());
                Assert.NotEqual(arr.Find(ValueFactory.Create("password")), ValueFactory.Create());
            }
        }
Beispiel #2
0
        public void SessionValues_CanBeRead()
        {
            var checks  = new Dictionary <string, byte[]>();
            var session = CreateSessionMock(checks);

            var oscriptSession = new SessionImpl(session);

            oscriptSession.SetString("user", "EvilBeaver");
            oscriptSession.SetNumber("num", 1);

            Assert.Equal("EvilBeaver", oscriptSession.GetString("user").AsString());
            Assert.Equal(1m, oscriptSession.GetNumber("num").AsNumber());
        }
Beispiel #3
0
        public void SessionValues_CanBeSet()
        {
            lock (TestOrderingLock.Lock)
            {
                var wa = new WebApplicationEngine();

                var checks  = new Dictionary <string, byte[]>();
                var session = CreateSessionMock(checks);

                var oscriptSession = new SessionImpl(session);
                oscriptSession.SetString("user", "EvilBeaver");

                Assert.Equal("EvilBeaver", Encoding.Default.GetString(checks["user"]));
            }
        }