public void Should_call_formatter_on_load() { var fakeFormatter = A.Fake <ISessionObjectFormatter>(); A.CallTo(() => this.encryptionProvider.Decrypt("encryptedkey1=value1", A <string> .Ignored, A <byte[]> .Ignored)).Returns("key1=value1;"); var store = new Nancy.Session.CookieBasedSessions(this.encryptionProvider, this.hmacProvider, "the passphrase", "the salt", "hmac passphrase", fakeFormatter); var request = CreateRequest("encryptedkey1=value1", false); store.Load(request); A.CallTo(() => fakeFormatter.Deserialize("value1")).MustHaveHappened(Repeated.Exactly.Once); }
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); }
public CookieBasedSessionsFixture() { this.encryptionProvider = A.Fake <IEncryptionProvider>(); this.hmacProvider = A.Fake <IHmacProvider>(); this.cookieStore = new Nancy.Session.CookieBasedSessions(this.encryptionProvider, this.hmacProvider, "the passphrase", "the salt", "hmac passphrase", new Fakes.FakeSessionObjectFormatter()); }
public CookieBasedSessionsFixture() { this.encryptionProvider = A.Fake<IEncryptionProvider>(); this.cookieStore = new Nancy.Session.CookieBasedSessions(this.encryptionProvider, "the passphrase", "the salt", new Fakes.FakeSessionObjectFormatter()); }
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); }
public void Should_call_formatter_on_load() { var fakeFormatter = A.Fake<ISessionObjectFormatter>(); A.CallTo(() => this.encryptionProvider.Decrypt("encryptedkey1=value1", A<string>.Ignored, A<byte[]>.Ignored)).Returns("key1=value1;"); var store = new Nancy.Session.CookieBasedSessions(this.encryptionProvider, "the passphrase", "the salt", fakeFormatter); var request = CreateRequest("encryptedkey1=value1", false); store.Load(request); A.CallTo(() => fakeFormatter.Deserialize("value1")).MustHaveHappened(Repeated.Exactly.Once); }