Exemplo n.º 1
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.ConvertTo <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));
        }
Exemplo n.º 2
0
        public void Does_translate()
        {
            var user = new User()
            {
                FirstName = "Demis",
                LastName  = "Bellot",
                Car       = new Car()
                {
                    Name = "BMW X6", Age = 3
                }
            };

            var userDto = user.ConvertTo <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}"));
        }
Exemplo n.º 3
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.ConvertTo<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));
        }
Exemplo n.º 4
0
        public void Does_translate()
        {
            var user = new User() {
                FirstName = "Demis",
                LastName = "Bellot",
                Car = new Car() { Name = "BMW X6", Age = 3 }
            };

            var userDto = user.ConvertTo<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}"));
        }