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; } }
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); }
public void CommentToEntityTextTest() { CommentEntity entity = testMapper.ToEntity(comment); Assert.AreEqual(entity.Text, comment.Text); }