Ejemplo n.º 1
0
        public async Task TranslateArray_Empty_Translated()
        {
            var translator = new AsyncTranslator();

            var to = await translator.TranslateArray(
                new TranslateFrom[0]);

            Assert.IsType <TranslateTo[]>(to);
            Assert.Equal(0, to.Length);
        }
Ejemplo n.º 2
0
        public async Task TranslateList_Empty_Translated()
        {
            var translator = new AsyncTranslator();

            var to = await translator.TranslateList(
                new TranslateFrom[0]);

            Assert.IsType <List <TranslateTo> >(to);
            Assert.Equal(0, to.Count);
        }
Ejemplo n.º 3
0
        public async Task TranslateTypedCollection_Empty_Translated()
        {
            var translator = new AsyncTranslator();

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

            Assert.IsType <List <TranslateTo> >(to);
            Assert.Equal(0, to.Count);
        }
Ejemplo n.º 4
0
        public async Task Translate_ToNewObject_Translated()
        {
            var translator = new AsyncTranslator();

            var to = await translator.Translate(new TranslateFrom()
            {
                Property = 1
            });

            Assert.Equal(1, to.Property);
        }
Ejemplo n.º 5
0
        public async Task TranslateArray_ToNewObject_Translated()
        {
            var translator = new AsyncTranslator();

            var to = await translator.TranslateArray(
                new TranslateFrom[]
            {
                new TranslateFrom()
                {
                    Property = 1
                },
                new TranslateFrom()
                {
                    Property = 2
                }
            });

            Assert.IsType <TranslateTo[]>(to);
            Assert.Equal(2, to.Length);
            Assert.Equal(1, to[0].Property);
            Assert.Equal(2, to[1].Property);
        }
Ejemplo n.º 6
0
        public async Task TranslateList_ToNewObject_Translated()
        {
            var translator = new AsyncTranslator();

            var to = await translator.TranslateList(
                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);
        }
Ejemplo n.º 7
0
        public void Translate_Null_ThrowsArgumentNullException()
        {
            var translator = new AsyncTranslator();

            Assert.ThrowsAsync <ArgumentNullException>("source", () => translator.Translate(null));
        }