public void TestThatFilterOnZReturnsNobody()
 {
     _param.GlobalSearch = "z";
     _filter = new DatatableFilter<Person>(_param, _properties);
     IQueryable<Person> filtered = _filter.Filter(People);
     Assert.That(filtered.Count(), Is.EqualTo(0), "There are no people with the letter 'Z' in their name");
 }
 public void TestThatFilterOnSpecialCharactersDoesntFailAndReturnsNobody()
 {
     _param.GlobalSearch = "&é'(§è!çà)'$^µù=:;~`µ´][*¨\\";
     _filter = new DatatableFilter<Person>(_param, _properties);
     IQueryable<Person> filtered = _filter.Filter(People);
     Assert.That(filtered.Count(), Is.EqualTo(0), "There are no people with a special name like that.");
 }
 public void TestThatFilterOnNameAlexReturnsAlex()
 {
     _param.GlobalSearch = Alex.Name;
     _filter = new DatatableFilter<Person>(_param, _properties);
     IQueryable<Person> filtered = _filter.Filter(People);
     Assert.That(filtered, Is.EquivalentTo(new[] {Alex}), "There's only one person with name Alex");
 }
Example #4
0
        public void TestThatSearchingForBirthdayWithYear1990ReturnsAlex()
        {
            _param.GlobalSearch = "1990";
            _filter             = new DatatableFilter <Person>(_param, _properties);
            IQueryable <Person> filtered = _filter.Filter(People);

            Assert.That(filtered, Is.EquivalentTo(new[] { Alex }));
        }
Example #5
0
        public void TestThatNoFilterDoesntChangeTheEntities()
        {
            _filter = new DatatableFilter <Person>(_param, _properties);
            IQueryable <Person> filtered = _filter.Filter(People);

            Assert.That(filtered, Is.EquivalentTo(People),
                        "The filter was empty, the list of people should be unchanged");
        }
Example #6
0
        public void TestThatFilterOnZReturnsNobody()
        {
            _param.GlobalSearch = "z";
            _filter             = new DatatableFilter <Person>(_param, _properties);
            IQueryable <Person> filtered = _filter.Filter(People);

            Assert.That(filtered.Count(), Is.EqualTo(0), "There are no people with the letter 'Z' in their name");
        }
Example #7
0
        public void TestThatFilterOnSpecialCharactersDoesntFailAndReturnsNobody()
        {
            _param.GlobalSearch = "&é'(§è!çà)'$^µù=:;~`µ´][*¨\\";
            _filter             = new DatatableFilter <Person>(_param, _properties);
            IQueryable <Person> filtered = _filter.Filter(People);

            Assert.That(filtered.Count(), Is.EqualTo(0), "There are no people with a special name like that.");
        }
Example #8
0
        public void TestThatFilterOnNameAlexReturnsAlex()
        {
            _param.GlobalSearch = Alex.Name;
            _filter             = new DatatableFilter <Person>(_param, _properties);
            IQueryable <Person> filtered = _filter.Filter(People);

            Assert.That(filtered, Is.EquivalentTo(new[] { Alex }), "There's only one person with name Alex");
        }
 public void TestThatFilterOnNameContainingAReturnsAlexAnnAndMatt()
 {
     _param.GlobalSearch = "a";
     _filter = new DatatableFilter<Person>(_param, _properties);
     IQueryable<Person> filtered = _filter.Filter(People);
     Assert.That(filtered, Is.EquivalentTo(new[] {Alex, Ann, Matt}),
                 "Alex, Ann and Matt all have the letter 'a' in their name");
 }
Example #10
0
        public void TestThatFilterOnNameContainingAReturnsAlexAnnAndMatt()
        {
            _param.GlobalSearch = "a";
            _filter             = new DatatableFilter <Person>(_param, _properties);
            IQueryable <Person> filtered = _filter.Filter(People);

            Assert.That(filtered, Is.EquivalentTo(new[] { Alex, Ann, Matt }),
                        "Alex, Ann and Matt all have the letter 'a' in their name");
        }
 public void TestThatSearchingForBirthdayWithYear1990ReturnsAlex()
 {
     _param.GlobalSearch = "1990";
     _filter = new DatatableFilter<Person>(_param, _properties);
     IQueryable<Person> filtered = _filter.Filter(People);
     Assert.That(filtered, Is.EquivalentTo(new[] {Alex}));
 }
 public void TestThatNoFilterDoesntChangeTheEntities()
 {
     _filter = new DatatableFilter<Person>(_param, _properties);
     IQueryable<Person> filtered = _filter.Filter(People);
     Assert.That(filtered, Is.EquivalentTo(People),
                 "The filter was empty, the list of people should be unchanged");
 }
Example #13
0
        /// <summary>
        ///     Applies the global filter, if any, to the entities
        /// </summary>
        /// <param name="param">
        ///     The param containing the global filter
        /// </param>
        /// <returns>
        ///     the filtered entities
        /// </returns>
        private IQueryable <TEntity> FilterGlobal(DatatableParam param)
        {
            var filter = new DatatableFilter <TEntity>(param, _properties);

            return(filter.Filter(_entities));
        }