public void Can_translate_generic_lists()
        {
            var values = new[] { "A", "B", "C" };
            var testA = new TestClassA
            {
                FromStringList = new ArrayOfString(values),
                ToStringList = new List<string>(values),
                FromUserFileTypes = new List<UserFileType>
                {
                    UserFileType.DefaultProfile, UserFileType.OriginalProfile
                },
            };

            var fromTestA = testA.ConvertTo<TestClassB>();

            AssertAreEqual(testA, fromTestA);

            var userFileTypeValues = testA.FromUserFileTypes.Map(x => x.ToString());
            var testB = new TestClassB
            {
                FromStringList = new List<string>(values),
                ToStringList = new ArrayOfString(values),
                FromUserFileTypes = new ArrayOfString(userFileTypeValues),
            };

            var fromTestB = testB.ConvertTo<TestClassA>();
            AssertAreEqual(fromTestB, testB);
        }
예제 #2
0
        public void Can_translate_generic_lists()
        {
            var values = new[] { "A", "B", "C" };
            var testA  = new TestClassA
            {
                FromStringList    = new ArrayOfString(values),
                ToStringList      = new List <string>(values),
                FromUserFileTypes = new List <UserFileType>
                {
                    UserFileType.DefaultProfile, UserFileType.OriginalProfile
                },
            };

            var fromTestA = testA.ConvertTo <TestClassB>();

            AssertAreEqual(testA, fromTestA);

            var userFileTypeValues = testA.FromUserFileTypes.Map(x => x.ToString());
            var testB = new TestClassB
            {
                FromStringList    = new List <string>(values),
                ToStringList      = new ArrayOfString(values),
                FromUserFileTypes = new ArrayOfString(userFileTypeValues),
            };

            var fromTestB = testB.ConvertTo <TestClassA>();

            AssertAreEqual(fromTestB, testB);
        }
        public void Can_translate_generic_list_does_ignore_protected_setters()
        {
            var values = new[] { "A", "B", "C" };
            var testA = new TestClassA
            {
                ToStringList = new List<string>(values),
            };

            var fromTestA = testA.ConvertTo<TestClassC>();
            Assert.NotNull(fromTestA);
            Assert.IsNull(fromTestA.FromStringList);
        }
예제 #4
0
        public void Can_translate_generic_list_does_ignore_protected_setters()
        {
            var values = new[] { "A", "B", "C" };
            var testA  = new TestClassA
            {
                ToStringList = new List <string>(values),
            };

            var fromTestA = testA.ConvertTo <TestClassC>();

            Assert.NotNull(fromTestA);
            Assert.IsNull(fromTestA.FromStringList);
        }