public static Participant AsEntity(this CreateParticipantDto dto) => new Participant { Email = dto.Email, Forename = dto.Forename, Surname = dto.Surname, CreatedAt = DateTime.Now };
public void CreateParticipantDto_AsEntity_MapsCorrectly() { //Arrange var createParticipantDto = new CreateParticipantDto() { Email = "test-email", Forename = "test-forename", Surname = "test-surname" }; //Act var participant = createParticipantDto.AsEntity(); //Assert Assert.AreEqual(createParticipantDto.Email, participant.Email); Assert.AreEqual(createParticipantDto.Forename, participant.Forename); Assert.AreEqual(createParticipantDto.Surname, participant.Surname); Assert.AreEqual(DateTime.Now.ToSecondsTolerance(), participant.CreatedAt.ToSecondsTolerance()); }