public void ApplyTo_NewQueryReturned_GivenQueryable_SingleProperty()
        {
            // Arrange
            ETag<Customer> etagCustomer = new ETag<Customer>();
            dynamic etag = etagCustomer;
            etag.FirstName = "TestFName";

            // Act
            IQueryable queryable = etagCustomer.ApplyTo(_customers.AsQueryable());

            // Assert
            Assert.NotNull(queryable);
            IEnumerable<Customer> actualCustomers = Assert.IsAssignableFrom<IEnumerable<Customer>>(queryable);
            Assert.Equal(new[] { 1 }, actualCustomers.Select(customer => customer.ID));
        }
        public void ApplyTo_NewQueryReturned_GivenQueryable_SingleProperty()
        {
            // Arrange
            ETag <Customer> etagCustomer = new ETag <Customer>();
            dynamic         etag         = etagCustomer;

            etag.FirstName = "TestFName";

            // Act
            IQueryable queryable = etagCustomer.ApplyTo(_customers.AsQueryable());

            // Assert
            Assert.NotNull(queryable);
            IEnumerable <Customer> actualCustomers = Assert.IsAssignableFrom <IEnumerable <Customer> >(queryable);

            Assert.Equal(new[] { 1 }, actualCustomers.Select(customer => customer.ID));
        }
Exemple #3
0
        public void ApplyTo_NewQueryReturned_GivenQueryable_NoMatch()
        {
            // Arrange
            ETag etagCustomer = new ETag {
                EntityType = typeof(Customer)
            };
            dynamic etag = etagCustomer;

            etag.FirstName = "foo";

            // Act
            IQueryable queryable = etagCustomer.ApplyTo(_customers.AsQueryable());

            // Assert
            Assert.NotNull(queryable);
            IEnumerable <Customer> actualCustomers = Assert.IsAssignableFrom <IEnumerable <Customer> >(queryable);

            Assert.Equal(new int[0], actualCustomers.Select(customer => customer.ID));
        }
Exemple #4
0
        public void ApplyTo_NewQueryReturned_GivenQueryable_MutipleProperties()
        {
            // Arrange
            ETag etagCustomer = new ETag {
                EntityType = typeof(Customer)
            };
            dynamic etag = etagCustomer;

            etag.FirstName = "Abc";
            etag.LastName  = "Xyz";

            // Act
            IQueryable queryable = etagCustomer.ApplyTo(_customers.AsQueryable());

            // Assert
            Assert.NotNull(queryable);
            IEnumerable <Customer> actualCustomers = Assert.IsAssignableFrom <IEnumerable <Customer> >(queryable);

            Assert.Equal(
                new[] { 2 },
                actualCustomers.Select(customer => customer.ID));
        }
Exemple #5
0
        public void ApplyTo_NewQueryReturned_GivenQueryable_NoMatch()
        {
            // Arrange
            ETag etagCustomer = new ETag { EntityType = typeof(Customer) };
            dynamic etag = etagCustomer;
            etag.FirstName = "foo";

            // Act     
            IQueryable queryable = etagCustomer.ApplyTo(_customers.AsQueryable());

            // Assert
            Assert.NotNull(queryable);
            IEnumerable<Customer> actualCustomers = Assert.IsAssignableFrom<IEnumerable<Customer>>(queryable);

            Assert.Equal(new int[0], actualCustomers.Select(customer => customer.ID));
        }
Exemple #6
0
        public void ApplyTo_NewQueryReturned_GivenQueryable_MutipleProperties()
        {
            // Arrange
            ETag etagCustomer = new ETag { EntityType = typeof(Customer) };
            dynamic etag = etagCustomer;
            etag.FirstName = "Abc";
            etag.LastName = "Xyz";

            // Act     
            IQueryable queryable = etagCustomer.ApplyTo(_customers.AsQueryable());

            // Assert
            Assert.NotNull(queryable);
            IEnumerable<Customer> actualCustomers = Assert.IsAssignableFrom<IEnumerable<Customer>>(queryable);
            Assert.Equal(
                new[] { 2 },
                actualCustomers.Select(customer => customer.ID));
        }