public void matches_credentials_postive()
        {
            var user1 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("something")
            };

            var user2 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("else")
            };

            theRepository.Update(user1);
            theRepository.Update(user2);

            theMembership.MatchesCredentials(new LoginRequest
            {
                UserName = "******",
                Password = "******"
            }).ShouldBeFalse();

            theMembership.MatchesCredentials(new LoginRequest
            {
                UserName = "******",
                Password = "******"
            }).ShouldBeFalse();

            theMembership.MatchesCredentials(new LoginRequest
            {
                UserName = "******",
                Password = "******"
            }).ShouldBeFalse();
        }
        public void matches_credentials_negative()
        {
            var user1 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("something")
            };

            var user2 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("else")
            };

            theRepository.Update(user1);
            theRepository.Update(user2);


            theMembership.MatchesCredentials(new LoginRequest
            {
                UserName = "******",
                Password = "******"
            }).ShouldBeTrue();

            theMembership.MatchesCredentials(new LoginRequest
            {
                UserName = "******",
                Password = "******"
            }).ShouldBeTrue();
        }
Exemplo n.º 3
0
        public void UsersAre(string UserName, string Password)
        {
            var user = new User
            {
                UserName = UserName,
                Password = Context.Service<IPasswordHash>().CreateHash(Password)
            };

            _repository.Update(user);
        }
        public void find_by_name()
        {
            var user1 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("something")
            };

            var user2 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("else")
            };

            theRepository.Update(user1);
            theRepository.Update(user2);

            theMembership.FindByName("jeremy").ShouldBeTheSameAs(user1);
            theMembership.FindByName("josh").ShouldBeTheSameAs(user2);
        }
        public void find_by_name()
        {
            var user1 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("something")
            };

            var user2 = new FubuMVC.RavenDb.Membership.User
            {
                UserName = "******",
                Password = theHash.CreateHash("else")
            };

            theRepository.Update(user1);
            theRepository.Update(user2);

            theMembership.FindByName("jeremy").ShouldBeTheSameAs(user1);
            theMembership.FindByName("josh").ShouldBeTheSameAs(user2);
        }