Exemplo n.º 1
0
        private void AddComments(EncounterEntity entity, ICollection <Commentary> commentaries)
        {
            IEnumerable <CommentEntity> commentEntities = commentaries.Select(c => commentConverter.ToEntity(c));

            foreach (CommentEntity ce in commentEntities)
            {
                entity.Commentaries.Add(ce);
                context.Entry(ce.Maker).State = EntityState.Unchanged;
            }
        }
Exemplo n.º 2
0
        public void DtoToEntityTest()
        {
            // Arrange
            var dto = new CommentResponseDTO
            {
                Id      = 1,
                Content = "Sunny day."
            };

            // Act
            var model = _commentMapper.ToEntity(dto);

            // Assert
            Assert.Equal(dto.Id, model.Id);
            Assert.Equal(dto.Content, model.Content);
        }
Exemplo n.º 3
0
        public void CommentToEntityTextTest()
        {
            CommentEntity entity = testMapper.ToEntity(comment);

            Assert.AreEqual(entity.Text, comment.Text);
        }