コード例 #1
0
        public async Task MapArrayAsync_ToNewObject_MappedAsync()
        {
            var mapper = new AsyncMapper();

            var to = await mapper
                     .MapArrayAsync(
                new MapFrom[]
            {
                new MapFrom()
                {
                    Property = 1
                },
                new MapFrom()
                {
                    Property = 2
                },
            },
                this.cancellationTokenSource.Token)
                     .ConfigureAwait(false);

            Assert.Equal(this.cancellationTokenSource.Token, mapper.CancellationToken);
            Assert.IsType <MapTo[]>(to);
            Assert.Equal(2, to.Length);
            Assert.Equal(1, to[0].Property);
            Assert.Equal(2, to[1].Property);
        }
コード例 #2
0
        public async Task MapArrayAsync_Empty_MappedAsync()
        {
            var mapper = new AsyncMapper();

            var to = await mapper.MapArrayAsync(Array.Empty <MapFrom>()).ConfigureAwait(false);

            Assert.IsType <MapTo[]>(to);
            Assert.Empty(to);
        }
コード例 #3
0
        public async Task MapArrayAsync_Empty_Mapped()
        {
            var mapper = new AsyncMapper();

            var to = await mapper.MapArrayAsync(
                new MapFrom[0]);

            Assert.IsType <MapTo[]>(to);
            Assert.Empty(to);
        }
コード例 #4
0
        public async Task MapArrayAsync_Empty_MappedAsync()
        {
            var mapper = new AsyncMapper();

            var to = await mapper
                     .MapArrayAsync(Array.Empty <MapFrom>(), this.cancellationTokenSource.Token)
                     .ConfigureAwait(false);

            Assert.IsType <MapTo[]>(to);
            Assert.Empty(to);
        }
コード例 #5
0
        public async Task MapArrayAsync_ToNewObject_Mapped()
        {
            var mapper = new AsyncMapper();

            var to = await mapper.MapArrayAsync(
                new MapFrom[]
            {
                new MapFrom()
                {
                    Property = 1
                },
                new MapFrom()
                {
                    Property = 2
                }
            });

            Assert.IsType <MapTo[]>(to);
            Assert.Equal(2, to.Length);
            Assert.Equal(1, to[0].Property);
            Assert.Equal(2, to[1].Property);
        }