public void OfType_Dynamic_ActingOnIt_Exceptions()
        {
            // Assign
            var qry = new BaseEmployee[]
            {
                new Worker {
                    Name = "1"
                }, new Boss {
                    Name = "b"
                }
            }.AsQueryable();

            // Act
            Assert.Throws <ParseException>(() => qry.Count("OfType()"));
            Assert.Throws <ParseException>(() => qry.Count("OfType(true)"));
            Assert.Throws <ParseException>(() => qry.Count("OfType(\"not-found\")"));
        }
        public void Is_Dynamic_ActingOnIt_WithType()
        {
            // Assign
            var qry = new BaseEmployee[]
            {
                new Worker {
                    Name = "1"
                }, new Boss {
                    Name = "b"
                }
            }.AsQueryable();

            // Act
            int countOfType        = qry.Count(c => c is Worker);
            int countOfTypeDynamic = qry.Count("is(@0)", typeof(Worker));

            // Assert
            Check.That(countOfTypeDynamic).Equals(countOfType);
        }
        public void Is_Dynamic_ActingOnIt()
        {
            // Assign
            var qry = new BaseEmployee[]
            {
                new Worker {
                    Name = "1"
                }, new Boss {
                    Name = "b"
                }
            }.AsQueryable();

            // Act
            int countOfType        = qry.Count(c => c is Worker);
            int countOfTypeDynamic = qry.Count("is(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\")");

            // Assert
            Check.That(countOfTypeDynamic).Equals(countOfType);
        }
        public void Is_Dynamic_ActingOnIt_WithSimpleName()
        {
            // Assign
            var config = new ParsingConfig
            {
                ResolveTypesBySimpleName = true
            };

            var qry = new BaseEmployee[]
            {
                new Worker {
                    Name = "1"
                }, new Boss {
                    Name = "b"
                }
            }.AsQueryable();

            // Act
            int countOfType        = qry.Count(c => c is Worker);
            int countOfTypeDynamic = qry.Count(config, "is(\"Worker\")");

            // Assert
            Check.That(countOfTypeDynamic).Equals(countOfType);
        }
        public void As_Dynamic_ActingOnIt_WithType()
        {
            // Assign
            var qry = new BaseEmployee[]
            {
                new Worker {
                    Name = "1"
                }, new Boss {
                    Name = "b"
                }
            }.AsQueryable();

            // Act
            int countAsDynamic = qry.Count("As(@0) != null", typeof(Worker));

            // Assert
            Check.That(countAsDynamic).Equals(1);
        }
        public void As_Dynamic_ActingOnIt()
        {
            // Assign
            var qry = new BaseEmployee[]
            {
                new Worker {
                    Name = "1"
                }, new Boss {
                    Name = "b"
                }
            }.AsQueryable();

            // Act
            int countAsDynamic = qry.Count("As(\"System.Linq.Dynamic.Core.Tests.Entities.Worker\") != null");

            // Assert
            Check.That(countAsDynamic).Equals(1);
        }