public void FindUsersByEmailQuery_Correctly_Builds_Expression() { var testObject = new FindUsersWithNameLikeQuery("Fred", "myApp"); var exp = testObject.MatchingCriteria; Expression body = exp.Body; Assert.Equal(ExpressionType.AndAlso, body.NodeType); Assert.Contains("(user.Username.StartsWith(value(nHibernate.Membership.Provider.Queries.FindUsersWithNameLikeQuery)._userName) ", body.ToString()); Assert.Contains("(user.ApplicationName == value(nHibernate.Membership.Provider.Queries.FindUsersWithNameLikeQuery)._applicationName)", body.ToString()); }
public void FindUsersByEmailQuery_Correctly_Builds_Expression() { var testObject = new FindUsersWithNameLikeQuery("Fred", "myApp"); var exp = testObject.MatchingCriteria; Expression body = exp.Body; Assert.Equal(ExpressionType.AndAlso, body.NodeType); Assert.Contains("(user.Username.StartsWith(value(nHibernate.Membership.Provider.Queries.FindUsersWithNameLikeQuery)._userName) ", body.ToString()); Assert.Contains("(user.ApplicationName == value(nHibernate.Membership.Provider.Queries.FindUsersWithNameLikeQuery)._applicationName)", body.ToString()); }
public void FindUsersWithNameLike_Creates_a_FindUsersByNameQuery_and_Passes_it_to_Repository() { var totalRecords = 0; var name = "foo"; var appName = "myApp"; var findUsersByNameQuery = new FindUsersWithNameLikeQuery(name, appName); _queryFactory.Setup(qf => qf.createFindUsersWithNameLikeQuery(name, appName)).Returns(findUsersByNameQuery); testObject.FindUsersByName(name, 0, 0, out totalRecords); _repository.Verify(r => r.GetQueryableList(findUsersByNameQuery)); }
public void DeleteUser_Creates_a_FindUsersByName_and_Passes_UserId_to_Delete_in_Repository() { var name = "foo"; var appName = "myApp"; var findUsersByNameQuery = new FindUsersWithNameLikeQuery(name, appName); _queryFactory.Setup(qf => qf.createFindUsersWithNameLikeQuery(name, appName)).Returns(findUsersByNameQuery); User user = new User { Id = Guid.NewGuid() }; _repository.Setup(r => r.GetOne(findUsersByNameQuery)).Returns(user); testObject.DeleteUser(name, false); _repository.Verify(r => r.Delete<User>(user.Id)); }
public void FindUsersWithNameLike_Creates_a_FindUsersByNameQuery_and_Passes_it_to_Repository() { var totalRecords = 0; var name = "foo"; var appName = "myApp"; var findUsersByNameQuery = new FindUsersWithNameLikeQuery(name, appName); _queryFactory.Setup(qf => qf.createFindUsersWithNameLikeQuery(name, appName)).Returns(findUsersByNameQuery); testObject.FindUsersByName(name, 0, 0, out totalRecords); _repository.Verify(r => r.GetQueryableList(findUsersByNameQuery)); }
public void DeleteUser_Creates_a_FindUsersByName_and_Passes_UserId_to_Delete_in_Repository() { var name = "foo"; var appName = "myApp"; var findUsersByNameQuery = new FindUsersWithNameLikeQuery(name, appName); _queryFactory.Setup(qf => qf.createFindUsersWithNameLikeQuery(name, appName)).Returns(findUsersByNameQuery); User user = new User { Id = Guid.NewGuid() }; _repository.Setup(r => r.GetOne(findUsersByNameQuery)).Returns(user); testObject.DeleteUser(name, false); _repository.Verify(r => r.Delete <User>(user.Id)); }