public InformationDto AddInfomation(InformationDto dto) { Information information = _modelMapper.FromInformationDto(dto); Information created = _informationRepository.Add(information); InformationDto createdInformationDto = _modelMapper.ToInformationDto(created); return(createdInformationDto); }
public void FromInformationDto_MapInformationFromDtoToModel() { Guid id = new Guid("0f8fad5b-d9cb-469f-a165-70867728950e"); string content = "Content test"; bool isDeleted = false; InformationDto informationDto = new InformationDto() { Id = id, IsDeleted = isDeleted, Content = content }; DtoModelMapper mapper = new DtoModelMapper(); Information information = mapper.FromInformationDto(informationDto); Assert.AreEqual(id, information.Id, "Copied 'Id' has invalid value"); Assert.AreEqual(content, information.Content, "Copied 'content' has invalid value"); Assert.AreEqual(isDeleted, information.IsDeleted, "Copied 'is deleted' has invalid value"); }