コード例 #1
0
        public void Should_save_nothing_if_the_session_is_null()
        {
            var response = new Response();

            cookieStore.Save(null, response);

            response.Cookies.Count.ShouldEqual(0);
        }
コード例 #2
0
        public void Should_call_the_formatter_on_save()
        {
            var response = new Response();
            var session  = new Session(new Dictionary <string, object>());

            session["key1"] = "value1";
            var fakeFormatter = A.Fake <ISessionObjectFormatter>();
            var store         = new Nancy.Session.CookieBasedSessions(this.encryptionProvider, this.hmacProvider, "the passphrase", "the salt", "hmac passphrase", fakeFormatter);

            store.Save(session, response);

            A.CallTo(() => fakeFormatter.Serialize("value1")).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #3
0
        public void Should_call_the_formatter_on_save()
        {
            var response = new Response();
            var session = new Session(new Dictionary<string, object>());
            session["key1"] = "value1";
            var fakeFormatter = A.Fake<ISessionObjectFormatter>();
            var store = new Nancy.Session.CookieBasedSessions(this.encryptionProvider, "the passphrase", "the salt", fakeFormatter);

            store.Save(session, response);

            A.CallTo(() => fakeFormatter.Serialize("value1")).MustHaveHappened(Repeated.Exactly.Once);
        }