Ejemplo n.º 1
0
        public void SelectUsingProjectToWithNullComplexSourceProperty()
        {
            var customers = new[] { new Customer { FirstName = "Bill", LastName = "White" } }.AsQueryable();

            var projected = customers.ProjectTo<CustomerDto>(_config).SingleOrDefault();
            projected.ShouldNotBeNull();
            projected.Address.ShouldBeNull();
        }
Ejemplo n.º 2
0
        public void ProjectToWithUnmappedTypeShouldThrowException()
        {
            var customers =
                new[] { new Customer { FirstName = "Bill", LastName = "White", Address = new Address("Street1") } }
                    .AsQueryable();

            IList<Unmapped> projected = null;

            typeof(InvalidOperationException).ShouldBeThrownBy(() => projected = customers.ProjectTo<Unmapped>(_config).ToList());

            projected.ShouldBeNull();
        }