public async Task MapTypedCollectionAsync_ToNewObject_MappedAsync() { var mapper = new AsyncMapper(); var to = await mapper .MapCollectionAsync( new MapFrom[] { new MapFrom() { Property = 1 }, new MapFrom() { Property = 2 }, }, new List <MapTo>()) .ConfigureAwait(false); Assert.IsType <List <MapTo> >(to); Assert.Equal(2, to.Count); Assert.Equal(1, to[0].Property); Assert.Equal(2, to[1].Property); }
public async Task MapCollectionAsync_ToNewObject_MappedAsync() { var mapper = new AsyncMapper(); var to = await mapper .MapCollectionAsync( new MapFrom[] { new MapFrom() { Property = 1 }, new MapFrom() { Property = 2 }, }, this.cancellationTokenSource.Token) .ConfigureAwait(false); Assert.Equal(this.cancellationTokenSource.Token, mapper.CancellationToken); Assert.IsType <Collection <MapTo> >(to); Assert.Equal(2, to.Count); Assert.Equal(1, to[0].Property); Assert.Equal(2, to[1].Property); }
public async Task MapTypedCollectionAsync_Empty_MappedAsync() { var mapper = new AsyncMapper(); var to = await mapper.MapCollectionAsync(Array.Empty <MapFrom>(), new List <MapTo>()).ConfigureAwait(false); Assert.IsType <List <MapTo> >(to); Assert.Empty(to); }
public async Task MapCollectionAsync_Empty_Mapped() { var mapper = new AsyncMapper(); var to = await mapper.MapCollectionAsync( new MapFrom[0]); Assert.IsType <Collection <MapTo> >(to); Assert.Empty(to); }
public async Task MapCollectionAsync_Empty_MappedAsync() { var mapper = new AsyncMapper(); var to = await mapper .MapCollectionAsync(Array.Empty <MapFrom>(), this.cancellationTokenSource.Token) .ConfigureAwait(false); Assert.IsType <Collection <MapTo> >(to); Assert.Empty(to); }
public async Task MapCollectionAsync_ToNewObject_Mapped() { var mapper = new AsyncMapper(); var to = await mapper.MapCollectionAsync( new MapFrom[] { new MapFrom() { Property = 1 }, new MapFrom() { Property = 2 } }); Assert.IsType <Collection <MapTo> >(to); Assert.Equal(2, to.Count); Assert.Equal(1, to[0].Property); Assert.Equal(2, to[1].Property); }