Exemple #1
0
 public void Is_Password_Hashed()
 {
     var data = new LoginData("Foo", "Bar");
     var hash = Hasher.GetSha512("Bar");
     Assert.That(data.Password, Is.Not.EqualTo("Bar"));
     Assert.That(data.Password, Is.EqualTo(hash));
 }
        public User Login(LoginData loginData)
        {
            var user = this.session.QueryOver<User>().Where(u => u.Username == loginData.Username).SingleOrDefault();

            return (user.Password == loginData.Password)
                ? user
                :null;
        }
        public void Login()
        {
            var consumer = new ClientServiceConsumer(this.serializer);

            var data = new LoginData("Login", "Login");

            var user = consumer.Login(data);

            Assert.That(user, Is.Not.Null);
        }
        public void Serialize_Request()
        {
            var loginData = new LoginData("Foo", "Bar");
            this.serializer = new WunschzettelSerializer();

            var serialized = this.serializer.Serialize(loginData);
            var deserialized =  this.serializer.Deserialize<LoginData>(serialized);

            Assert.That(loginData.Username, Is.EqualTo(deserialized.Username));
            Assert.That(loginData.Password, Is.EqualTo(deserialized.Password));
        }
Exemple #5
0
        public void LogIn()
        {
            var data = new LoginData("Foo", "Bar");

            this.service = MockRepository.GenerateMock<IClientServiceConsumer>();
            this.service.Expect(s => s.Login(Arg<LoginData>.Is.Equal(data)));

            var loginHelper = new LoginHelper(this.service);
            loginHelper.Login(data);

            this.service.VerifyAllExpectations();
        }
        public User Login(LoginData data)
        {
            var serializedData = this.serializer.Serialize<LoginData>(data);

            var dataStream = Encoding.UTF8.GetBytes(serializedData);

            var responeStream = this.client.UploadData("Login", dataStream);

            var respone = Encoding.UTF8.GetString(responeStream);

            var user = this.serializer.Deserialize<User>(respone);

            return user;
        }
        public void Login()
        {
            var loginData = new LoginData("Login", "Login");

            var user = this.database.Login(loginData);

            Assert.That(user, Is.Not.Null);
        }
        public void InvalidLogin()
        {
            var loginData = new LoginData("Login", "WrongPassword");

            var user = this.database.Login(loginData);

            Assert.That(user, Is.Null);
        }
 public void Login(LoginData data)
 {
     this.service.Login(data);
 }
 public User Login(LoginData data)
 {
     return this.database.Login(data);
 }