예제 #1
0
        public void Does_translate()
        {
            var user = new User()
            {
                FirstName = "Demis",
                LastName = "Bellot",
                Car = new Car() { Name = "BMW X6", Age = 3 }
            };

            var userDto = user.TranslateTo<UserDto>();

            Assert.That(userDto.FirstName, Is.EqualTo(user.FirstName));
            Assert.That(userDto.LastName, Is.EqualTo(user.LastName));
            Assert.That(userDto.Car, Is.EqualTo("{Name:BMW X6,Age:3}"));
        }
예제 #2
0
        public void Does_translate_to_inherited_propeties()
        {
            var user = new User {
                FirstName = "Demis",
                LastName  = "Bellot",
                Car       = new Car {
                    Name = "BMW X6", Age = 3
                }
            };

            var to = user.TranslateTo <SubUserFields>();

            Assert.That(to.FirstName, Is.EqualTo(user.FirstName));
            Assert.That(to.LastName, Is.EqualTo(user.LastName));
            Assert.That(to.Car.Name, Is.EqualTo(user.Car.Name));
            Assert.That(to.Car.Age, Is.EqualTo(user.Car.Age));
        }
예제 #3
0
        public void Does_translate()
        {
            var user = new User()
            {
                FirstName = "Demis",
                LastName  = "Bellot",
                Car       = new Car()
                {
                    Name = "BMW X6", Age = 3
                }
            };

            var userDto = user.TranslateTo <UserDto>();

            Assert.That(userDto.FirstName, Is.EqualTo(user.FirstName));
            Assert.That(userDto.LastName, Is.EqualTo(user.LastName));
            Assert.That(userDto.Car, Is.EqualTo("{Name:BMW X6,Age:3}"));
        }
예제 #4
0
        public void Does_translate_to_inherited_propeties()
        {
            var user = new User {
                FirstName = "Demis",
                LastName = "Bellot",
                Car = new Car { Name = "BMW X6", Age = 3 }
            };

            var to = user.TranslateTo<SubUserFields>();
            Assert.That(to.FirstName, Is.EqualTo(user.FirstName));
            Assert.That(to.LastName, Is.EqualTo(user.LastName));
            Assert.That(to.Car.Name, Is.EqualTo(user.Car.Name));
            Assert.That(to.Car.Age, Is.EqualTo(user.Car.Age));
        }