示例#1
0
        public async Task TranslateTypedCollection_Empty_Translated()
        {
            var translator = new AsyncTranslator();

            var to = await translator.TranslateCollection <List <TranslateTo>, TranslateFrom, TranslateTo>(
                new TranslateFrom[0]);

            Assert.IsType <List <TranslateTo> >(to);
            Assert.Equal(0, to.Count);
        }
示例#2
0
        public async Task TranslateTypedCollection_ToNewObject_Translated()
        {
            var translator = new AsyncTranslator();

            var to = await translator.TranslateCollection <List <TranslateTo>, TranslateFrom, TranslateTo>(
                new TranslateFrom[]
            {
                new TranslateFrom()
                {
                    Property = 1
                },
                new TranslateFrom()
                {
                    Property = 2
                }
            });

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