public void ProjectingEnumToString()
        {
            var customers = new[] { new Customer() { FirstName = "Bill", LastName = "White", CustomerType = CustomerType.Vip } }.AsQueryable();

            var projected = customers.ProjectTo<CustomerDto>();
            projected.ShouldNotBeNull();
            Assert.Equal(customers.Single().CustomerType.ToString().ToUpper(), projected.Single().CustomerType);
        }
Exemple #2
0
        protected override void Because_of()
        {
            var sources = new[]
            {
                new Source
                {
                    Value = 5
                }
            }.AsQueryable();

            _dests = sources.ProjectTo<Dest>(Configuration).ToArray();
        }
            protected override void Because_of()
            {
                IQueryable<Source> sources = new[]
                {
                    new Source()
                    {
                        OtherValue = 10
                    }
                }.AsQueryable();

                _dest = sources.ProjectTo<Dest>().ToArray();
            }
        protected override void Because_of()
        {
            var values = new[]
            {
                new Source()
                {
                    Value = 5
                }
            }.AsQueryable();

            _dest = values.ProjectTo<Dest>().ToArray();
        }
Exemple #5
0
        public void Can_project_statically()
        {
            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap<Source, Dest>();
            });

            var source = new Source {Value = 5};
            var sources = new[] {source}.AsQueryable();

            var dests = sources.ProjectTo<Dest>().ToArray();

            dests.Length.ShouldEqual(1);
            dests[0].Value.ShouldEqual(source.Value);
        }