public void GetNumberOfUsersOnline_Creates_a_UsersLastActivityQuery_and_Passes_it_to_Repository()
        {
            var appName = "myApp";
            var usersLastActivityQuery = new UsersLastActivityQuery(DateTime.Now, appName);

            _queryFactory.Setup(qf => qf.createUsersLastActivityQuery(It.IsAny<DateTime>(), appName)).Returns(usersLastActivityQuery);

            var result = testObject.GetNumberOfUsersOnline();

            _repository.Verify(r => r.GetQueryableList(It.IsAny<UsersLastActivityQuery>()));
        }
        public void UsersLastActivityQuery_Correctly_Builds_Expression()
        {
            var testObject = new UsersLastActivityQuery( DateTime.Now, "myApp");

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

            Assert.Equal(ExpressionType.AndAlso, body.NodeType);
            Assert.Contains("(user.LastActivityDate > value(nHibernate.Membership.Provider.Queries.UsersLastActivityQuery)._lastActivityDate)", body.ToString());
            Assert.Contains("(user.ApplicationName == value(nHibernate.Membership.Provider.Queries.UsersLastActivityQuery)._applicationName)", body.ToString());
        }
        public void UsersLastActivityQuery_Correctly_Builds_Expression()
        {
            var testObject = new UsersLastActivityQuery(DateTime.Now, "myApp");

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

            Assert.Equal(ExpressionType.AndAlso, body.NodeType);
            Assert.Contains("(user.LastActivityDate > value(nHibernate.Membership.Provider.Queries.UsersLastActivityQuery)._lastActivityDate)", body.ToString());
            Assert.Contains("(user.ApplicationName == value(nHibernate.Membership.Provider.Queries.UsersLastActivityQuery)._applicationName)", body.ToString());
        }
        public void GetNumberOfUsersOnline_Creates_a_UsersLastActivityQuery_and_Passes_it_to_Repository()
        {
            var appName = "myApp";
            var usersLastActivityQuery = new UsersLastActivityQuery(DateTime.Now, appName);

            _queryFactory.Setup(qf => qf.createUsersLastActivityQuery(It.IsAny <DateTime>(), appName)).Returns(usersLastActivityQuery);


            var result = testObject.GetNumberOfUsersOnline();

            _repository.Verify(r => r.GetQueryableList(It.IsAny <UsersLastActivityQuery>()));
        }