예제 #1
0
        public void Parsing_character_dto_to_character_entity(string name, string planet)
        {
            // Arrange
            var episodes = new List <string>()
            {
                "New Hope", "Empire", "Jedi"
            };
            var friends = new List <string>()
            {
                "Leia", "Han Solo", "Joda"
            };
            StarWarsCharacterDto characterDto = new StarWarsCharacterDto {
                Id = Guid.NewGuid(), Name = name, Planet = planet, Episodes = episodes, Friends = friends
            };
            CharacterParser parser = new CharacterParser();

            // Act
            var characterEntity = parser.CharacterDtoToEntity(characterDto);

            // Assert
            Assert.Equal(characterDto.Id, characterEntity.Id);
            Assert.Equal(characterDto.Name, characterEntity.Name);
            Assert.Equal(characterDto.Planet, characterEntity.Planet);
            Assert.Equal(characterDto.Episodes, characterEntity.Episodes.Select(x => x.EpisodeName));
            Assert.Equal(characterDto.Friends, characterEntity.Friends.Select(x => x.FriendName));
        }