public void Success()
            {
                var token = SessionDataSerializer.Serialize(this.Crypto, this.sessionData);
                var request = this.CreateMockRequest(this.sessionData.IpAddress, this.sessionData.UserAgent, token);
                HttpRequestSessionDataVerifier verifier = new HttpRequestSessionDataVerifier(this.Crypto, this.userReader.Object, this.ipReader.Object);

                SessionData session = verifier.VerifySession(request.Object);
                Assert.AreEqual(this.sessionData.UserId, session.UserId);
            }
            public void SessionUserNotExistsFails()
            {
                this.sessionData.UserId = "null";
                var token = SessionDataSerializer.Serialize(this.Crypto, this.sessionData);
                var request = this.CreateMockRequest(this.sessionData.IpAddress, this.sessionData.UserAgent, token);
                Mock<ISessionUserReader> userReader = this.CreateMockUserReader(this.sessionData.UserId);

                HttpRequestSessionDataVerifier verifier = new HttpRequestSessionDataVerifier(this.Crypto, userReader.Object, this.ipReader.Object);
                verifier.VerifySession(request.Object);
            }
            public void RemoteIpNotMatchingSessionIpFails()
            {
                this.sessionData.IpAddress = "200.100.20.2";
                var token = SessionDataSerializer.Serialize(this.Crypto, this.sessionData);
                var request = this.CreateMockRequest("192.168.77.254", "Google Chrome", token);
                HttpRequestSessionDataVerifier verifier = new HttpRequestSessionDataVerifier(this.Crypto, this.userReader.Object, this.ipReader.Object);

                verifier.VerifySession(request.Object);
            }
            public void NonMatchingUserAgentFails()
            {
                this.sessionData.UserAgent = "Mozilla Firefox";
                var token = SessionDataSerializer.Serialize(this.Crypto, this.sessionData);
                var request = this.CreateMockRequest(this.sessionData.IpAddress, "Google Chrome", token);
                HttpRequestSessionDataVerifier verifier = new HttpRequestSessionDataVerifier(this.Crypto, this.userReader.Object, this.ipReader.Object);

                verifier.VerifySession(request.Object);
            }
            public void EmptyUserAgentFails()
            {
                var token = SessionDataSerializer.Serialize(this.Crypto, this.sessionData);
                var request = this.CreateMockRequest("127.0.0.1", string.Empty, token);
                HttpRequestSessionDataVerifier verifier = new HttpRequestSessionDataVerifier(this.Crypto, this.userReader.Object, this.ipReader.Object);

                verifier.VerifySession(request.Object);
            }
            public void EmptySessionIdFails()
            {
                this.sessionData.SessionId = null;
                var token = SessionDataSerializer.Serialize(this.Crypto, this.sessionData);
                var request = this.CreateMockRequest(this.sessionData.IpAddress, this.sessionData.UserAgent, token);
                HttpRequestSessionDataVerifier verifier = new HttpRequestSessionDataVerifier(this.Crypto, this.userReader.Object, this.ipReader.Object);

                verifier.VerifySession(request.Object);
            }