Exemplo n.º 1
0
        public async Task MapAsyncEnumerable_ToNewObject_MappedAsync()
        {
            var mapper = new AsyncMapper();
            var source = new TestAsyncEnumerable <MapFrom>(
                new MapFrom[]
            {
                new MapFrom()
                {
                    Property = 1
                },
                new MapFrom()
                {
                    Property = 2
                }
            });

            var to = mapper.MapAsyncEnumerable(source);

            var list = await to.ToListAsync().ConfigureAwait(false);

            Assert.IsType <List <MapTo> >(list);
            Assert.Equal(2, list.Count);
            Assert.Equal(1, list[0].Property);
            Assert.Equal(2, list[1].Property);
        }