public void ProjectWithNullCollectionSourceProperty()
        {
            var customers = new[] { new Customer() }.AsQueryable();

            var mapped = customers.Project().To<CustomerDto>().SingleOrDefault();

            mapped.ShouldNotBeNull();
            mapped.Addresses.ShouldBeNull();
        }
        public void ProjectWithAssignedCollectionSourceProperty()
        {
            var customer = new Customer { Addresses = new List<Address> { new Address(Street1), new Address(Street2) } };
            var customers = new[] { customer }.AsQueryable();

            var mapped = customers.Project().To<CustomerDto>().SingleOrDefault();

            mapped.ShouldNotBeNull();

            mapped.Addresses.ShouldBeOfLength(2);
            mapped.Addresses.ElementAt(0).Street.ShouldEqual(Street1);
            mapped.Addresses.ElementAt(1).Street.ShouldEqual(Street2);
        }
Exemplo n.º 3
0
        protected override void Because_of()
        {
            var source = new[] { new Source { Value = 10 } }.AsQueryable();

            _dests = source.Project().To<Dest>().ToList();
        }