public async Task MapObservableCollectionAsync_ToNewObject_MappedAsync()
        {
            var mapper = new AsyncMapper();

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

            Assert.Equal(this.cancellationTokenSource.Token, mapper.CancellationToken);
            Assert.IsType <ObservableCollection <MapTo> >(to);
            Assert.Equal(2, to.Count);
            Assert.Equal(1, to[0].Property);
            Assert.Equal(2, to[1].Property);
        }
Exemple #2
0
        public async Task MapObservableCollectionAsync_Empty_Mapped()
        {
            var mapper = new AsyncMapper();

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

            Assert.IsType <ObservableCollection <MapTo> >(to);
            Assert.Empty(to);
        }
Exemple #3
0
        public async Task MapObservableCollectionAsync_Empty_MappedAsync()
        {
            var mapper = new AsyncMapper();

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

            Assert.IsType <ObservableCollection <MapTo> >(to);
            Assert.Empty(to);
        }
Exemple #4
0
        public async Task MapObservableCollectionAsync_ToNewObject_Mapped()
        {
            var mapper = new AsyncMapper();

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

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