public void ValidateUser_Creates_a_FindValidatedUserByUsernameQuery_and_Passes_it_to_Repository()
        {
            var username = "******";
            var password = "******";
            var appName = "myApp";
            var findValidatedUserByUsernameQuery = new FindValidatedUserByUsernameQuery(username, appName);
            _queryFactory.Setup(qf => qf.createFindValidatedUserByUsernameQuery(username, appName)).Returns(findValidatedUserByUsernameQuery);

            testObject.ValidateUser(username, password);

            _repository.Verify(r => r.GetOne(findValidatedUserByUsernameQuery));
        }
Example #2
0
        public void FindValidatedUserByEmailQuery_Correctly_Builds_Expression()
        {
            var testObject = new FindValidatedUserByUsernameQuery("*****@*****.**", "myApp");

            var        exp  = testObject.MatchingCriteria;
            Expression body = exp.Body;

            Assert.Equal(ExpressionType.AndAlso, body.NodeType);
            Assert.Contains("(user.Username == value(nHibernate.Membership.Provider.Queries.FindValidatedUserByUsernameQuery)._username)", body.ToString());
            Assert.Contains("(user.ApplicationName == value(nHibernate.Membership.Provider.Queries.FindValidatedUserByUsernameQuery)._applicationName)", body.ToString());
            Assert.Contains("(user.IsLockedOut == False)", body.ToString());
        }
        public void FindValidatedUserByEmailQuery_Correctly_Builds_Expression()
        {
            var testObject = new FindValidatedUserByUsernameQuery("*****@*****.**", "myApp");

            var exp = testObject.MatchingCriteria;
            Expression body = exp.Body;

            Assert.Equal(ExpressionType.AndAlso, body.NodeType);
            Assert.Contains("(user.Username == value(nHibernate.Membership.Provider.Queries.FindValidatedUserByUsernameQuery)._username)", body.ToString());
            Assert.Contains("(user.ApplicationName == value(nHibernate.Membership.Provider.Queries.FindValidatedUserByUsernameQuery)._applicationName)", body.ToString());
            Assert.Contains("(user.IsLockedOut == False)", body.ToString());
        }
Example #4
0
        public void ValidateUser_Creates_a_FindValidatedUserByUsernameQuery_and_Passes_it_to_Repository()
        {
            var username = "******";
            var password = "******";
            var appName  = "myApp";
            var findValidatedUserByUsernameQuery = new FindValidatedUserByUsernameQuery(username, appName);

            _queryFactory.Setup(qf => qf.createFindValidatedUserByUsernameQuery(username, appName)).Returns(findValidatedUserByUsernameQuery);

            testObject.ValidateUser(username, password);

            _repository.Verify(r => r.GetOne(findValidatedUserByUsernameQuery));
        }