Fin conflits fusion
continuous-integration/drone/push Build is passing Details

pull/45/head
Maxime SAPOUNTZIS 1 year ago
parent c5895d2801
commit 0820badb49

@ -16,7 +16,7 @@ public static class LessonMapper
return new LessonDto(model.Id, model.Title, model.LastPublisher, model.LastEdit, model.Content.Select(c => c.FromEntityToDto()).ToList());
}
public static LessonDto FromEntityToDTOPost(this LessonEntity model)
public static LessonDto FromEntityToDtoPost(this LessonEntity model)
{
return new LessonDto(model.Id, model.Title, model.LastPublisher, model.LastEdit);
}

@ -18,7 +18,7 @@ public static class ParagraphMapper
public static ParagraphDto FromEntityToDto(this ParagraphEntity model)
{
return new ParagraphDto(model.Id, model.ContentTitle, model.ContentContent, model.Info, model.Query,
return new ParagraphDto(model.Id, model.Title, model.Content, model.Info, model.Query,
model.Comment, model.LessonId);
}

@ -2,7 +2,7 @@
namespace TestEF.Dto;
public class TestBlackListDTO
public class TestBlackListDto
{
private const string _email = "email@email.com";
private DateOnly _date = new DateOnly(2025,01,21);
@ -11,7 +11,7 @@ public class TestBlackListDTO
[Fact]
public void TestConstructorWithAllAttributes()
{
BlackListDTO inquiry = new BlackListDTO(_email,_date);
BlackListDto inquiry = new BlackListDto(_email,_date);
Assert.Equal(_email, inquiry.Email);
Assert.Equal(_date, inquiry.ExpirationDate);
}

@ -20,8 +20,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
BlackListDTO blacklist = new BlackListDTO(_email,_date);
var blackListEntity = blacklist.FromDTOToEntity();
BlackListDto blacklist = new BlackListDto(_email,_date);
var blackListEntity = blacklist.FromDtoToEntity();
Assert.NotNull(blackListEntity);
Assert.IsType<BlackListEntity>(blackListEntity);
@ -33,8 +33,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
BlackListDTO blacklist = new BlackListDTO(_email,_date);
var blackListMod = blacklist.FromDTOToModel();
BlackListDto blacklist = new BlackListDto(_email,_date);
var blackListMod = blacklist.FromDtoToModel();
Assert.NotNull(blackListMod);
Assert.IsType<BlackList>(blackListMod);
@ -46,19 +46,19 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
BlackListEntity blacklist = new BlackListEntity(_email,_date);
var blackListDto = blacklist.FromEntityToDTO();
BlackListEntity blacklist = new BlackListEntity{Email=_email ,ExpirationDate =_date};
var BlackListDto = blacklist.FromEntityToDto();
Assert.NotNull(blackListDto);
Assert.IsType<BlackListDTO>(blackListDto);
Assert.Equal(_date, blackListDto.ExpirationDate);
Assert.Equal(_email, blackListDto.Email);
Assert.NotNull(BlackListDto);
Assert.IsType<BlackListDto>(BlackListDto);
Assert.Equal(_date, BlackListDto.ExpirationDate);
Assert.Equal(_email, BlackListDto.Email);
}
[Fact]
public void TestEntityToModel()
{
BlackListEntity blacklist = new BlackListEntity(_email,_date);
BlackListEntity blacklist = new BlackListEntity { Email = _email, ExpirationDate = _date };
var blackListMod = blacklist.FromEntityToModel();
Assert.NotNull(blackListMod);
@ -73,10 +73,10 @@ namespace TestEF.Mapper
public void TestModelToDto()
{
BlackList blacklist = new BlackList(_email,_date);
var BlackListDto = blacklist.FromModelToDTO();
var BlackListDto = blacklist.FromModelToDto();
Assert.NotNull(BlackListDto);
Assert.IsType<BlackListDTO>(BlackListDto);
Assert.IsType<BlackListDto>(BlackListDto);
Assert.Equal(_date, BlackListDto.ExpirationDate);
Assert.Equal(_email, BlackListDto.Email);
}

@ -20,8 +20,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
InquiryDTO inquiry = new InquiryDTO(_id, _title, _description, _isUser);
var inquiryEntity = inquiry.FromDTOToEntity();
InquiryDto inquiry = new InquiryDto(_id, _title, _description, _isUser);
var inquiryEntity = inquiry.FromDtoToEntity();
Assert.NotNull(inquiryEntity);
Assert.IsType<InquiryEntity>(inquiryEntity);
@ -33,12 +33,12 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
InquiryEntity inquiry = new InquiryEntity(_id,_title, _description, _isUser);
InquiryEntity inquiry = new InquiryEntity{Id =_id,Title =_title,Description = _description,IsUser= _isUser};
var inquiryDto = inquiry.FromEntityToDTO();
var inquiryDto = inquiry.FromEntityToDto();
Assert.NotNull(inquiryDto);
Assert.IsType<InquiryDTO>(inquiryDto);
Assert.IsType<InquiryDto>(inquiryDto);
Assert.Equal(1, inquiryDto.Id);
Assert.Equal(_title, inquiryDto.Title);
Assert.Equal(_description, inquiryDto.Description);
@ -61,7 +61,7 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToModel()
{
InquiryEntity inquiry = new InquiryEntity(_id,_title, _description, _isUser);
InquiryEntity inquiry = new InquiryEntity { Id = _id, Title = _title, Description = _description, IsUser = _isUser };
var inquiryMod = inquiry.FromEntityToModel();
@ -77,8 +77,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
InquiryDTO inquiry = new InquiryDTO(_id, _title, _description, _isUser);
var inquiryMod = inquiry.FromDTOToEntity();
InquiryDto inquiry = new InquiryDto(_id, _title, _description, _isUser);
var inquiryMod = inquiry.FromDtoToEntity();
Assert.NotNull(inquiryMod);
Assert.IsType<InquiryEntity>(inquiryMod);
@ -92,10 +92,10 @@ namespace TestEF.Mapper
{
Inquiry inquiry = new Inquiry(_id,_title, _description, _isUser);
var inquiryDto = inquiry.FromModelToDTO();
var inquiryDto = inquiry.FromModelToDto();
Assert.NotNull(inquiryDto);
Assert.IsType<InquiryDTO>(inquiryDto);
Assert.IsType<InquiryDto>(inquiryDto);
Assert.Equal(1, inquiryDto.Id);
Assert.Equal(_title, inquiryDto.Title);
Assert.Equal(_description, inquiryDto.Description);

@ -22,8 +22,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
InquiryTableDTO inquiryTable = new InquiryTableDTO(_ownerId,_databaseName,_connectionInfo);
var inquiryTableEntity = inquiryTable.FromDTOToEntity();
InquiryTableDto inquiryTable = new InquiryTableDto(_ownerId,_databaseName,_connectionInfo);
var inquiryTableEntity = inquiryTable.FromDtoToEntity();
Assert.NotNull(inquiryTableEntity);
Assert.IsType<InquiryTableEntity>(inquiryTableEntity);
@ -36,8 +36,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
InquiryTableDTO inquiryTable = new InquiryTableDTO(_ownerId,_databaseName,_connectionInfo);
var inquiryTableMod = inquiryTable.FromDTOToModel();
InquiryTableDto inquiryTable = new InquiryTableDto(_ownerId,_databaseName,_connectionInfo);
var inquiryTableMod = inquiryTable.FromDtoToModel();
Assert.NotNull(inquiryTableMod);
Assert.IsType<InquiryTable>(inquiryTableMod);
@ -50,11 +50,11 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
InquiryTableEntity inquiryTable = new InquiryTableEntity(_ownerId,_databaseName,_connectionInfo);
var inquiryTableDto = inquiryTable.FromEntityToDTO();
InquiryTableEntity inquiryTable = new InquiryTableEntity{OwnerId = _ownerId, DatabaseName = _databaseName, ConnectionInfo = _connectionInfo};
var inquiryTableDto = inquiryTable.FromEntityToDto();
Assert.NotNull(inquiryTableDto);
Assert.IsType<InquiryTableDTO>(inquiryTableDto);
Assert.IsType<InquiryTableDto>(inquiryTableDto);
Assert.Equal(_ownerId, inquiryTableDto.OwnerId);
Assert.Equal(_databaseName, inquiryTableDto.DatabaseName);
Assert.Equal(_connectionInfo, inquiryTableDto.ConnectionInfo);
@ -63,7 +63,7 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToModel()
{
InquiryTableEntity inquiryTable = new InquiryTableEntity(_ownerId,_databaseName,_connectionInfo);
InquiryTableEntity inquiryTable = new InquiryTableEntity { OwnerId = _ownerId, DatabaseName = _databaseName, ConnectionInfo = _connectionInfo };
var inquiryTableMod = inquiryTable.FromEntityToModel();
Assert.NotNull(inquiryTableMod);
@ -79,10 +79,10 @@ namespace TestEF.Mapper
public void TestModelToDto()
{
InquiryTable inquiryTable = new InquiryTable(_ownerId,_databaseName,_connectionInfo);
var inquiryTableDto = inquiryTable.FromModelToDTO();
var inquiryTableDto = inquiryTable.FromModelToDto();
Assert.NotNull(inquiryTableDto);
Assert.IsType<InquiryTableDTO>(inquiryTableDto);
Assert.IsType<InquiryTableDto>(inquiryTableDto);
Assert.Equal(_ownerId, inquiryTableDto.OwnerId);
Assert.Equal(_databaseName, inquiryTableDto.DatabaseName);
Assert.Equal(_connectionInfo, inquiryTableDto.ConnectionInfo);

@ -20,8 +20,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
LessonDTO lesson = new LessonDTO(_id, _title, _lastPublisher, date);
var lessonEntity = lesson.FromDTOToEntity();
LessonDto lesson = new LessonDto(_id, _title, _lastPublisher, date);
var lessonEntity = lesson.FromDtoToEntity();
Assert.NotNull(lessonEntity);
Assert.IsType<LessonEntity>(lessonEntity);
@ -34,8 +34,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
LessonDTO lesson = new LessonDTO(_id, _title, _lastPublisher, date);
var lessonMod = lesson.FromDTOToModel();
LessonDto lesson = new LessonDto(_id, _title, _lastPublisher, date);
var lessonMod = lesson.FromDtoToModel();
Assert.NotNull(lessonMod);
Assert.IsType<Lesson>(lessonMod);
@ -47,12 +47,12 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
LessonEntity lesson = new LessonEntity(_id,_title, _lastPublisher, date);
LessonEntity lesson = new LessonEntity{Id = _id,Title = _title,LastPublisher = _lastPublisher,LastEdit = date};
var lessonDto = lesson.FromEntityToDTO();
var lessonDto = lesson.FromEntityToDto();
Assert.NotNull(lessonDto);
Assert.IsType<LessonDTO>(lessonDto);
Assert.IsType<LessonDto>(lessonDto);
Assert.Equal(1, lessonDto.Id);
Assert.Equal(_title, lessonDto.Title);
Assert.Equal(_lastPublisher, lessonDto.LastPublisher);
@ -61,7 +61,7 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToModel()
{
LessonEntity lesson = new LessonEntity(_id, _title, _lastPublisher, date);
LessonEntity lesson = new LessonEntity { Id = _id, Title = _title, LastPublisher = _lastPublisher, LastEdit = date };
var lessonMod = lesson.FromEntityToModel();
@ -79,10 +79,10 @@ namespace TestEF.Mapper
{
Lesson lesson = new Lesson(_id, _title, _lastPublisher, date);
var lessonDto = lesson.FromModelToDTO();
var lessonDto = lesson.FromModelToDto();
Assert.NotNull(lessonDto);
Assert.IsType<LessonDTO>(lessonDto);
Assert.IsType<LessonDto>(lessonDto);
Assert.Equal(1, lessonDto.Id);
Assert.Equal(_title, lessonDto.Title);
Assert.Equal(_lastPublisher, lessonDto.LastPublisher);

@ -23,14 +23,14 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
NotepadDTO notepad = new NotepadDTO(_id,_userId,_inquiryId,_notes);
var notepadEntity = notepad.FromDTOToEntity();
NotepadDto notepad = new NotepadDto(_id,_userId,_inquiryId,_notes);
var notepadEntity = notepad.FromDtoToEntity();
Assert.NotNull(notepadEntity);
Assert.IsType<NotepadEntity>(notepadEntity);
Assert.Equal(0, notepadEntity.Id);
Assert.Equal(1, notepadEntity.Id);
Assert.Equal(_userId, notepadEntity.UserId);
Assert.Equal(1, notepadEntity.InquiryId);
Assert.Equal(0, notepadEntity.InquiryId);
Assert.Equal(_notes, notepadEntity.Notes);
}
@ -38,8 +38,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
NotepadDTO notepad = new NotepadDTO(_id,_userId,_inquiryId,_notes);
var notepadMod = notepad.FromDTOToModel();
NotepadDto notepad = new NotepadDto(_id,_userId,_inquiryId,_notes);
var notepadMod = notepad.FromDtoToModel();
Assert.NotNull(notepadMod);
Assert.IsType<Notepad>(notepadMod);
@ -53,27 +53,27 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
NotepadEntity notepad = new NotepadEntity(_id, new UserEntity(), _inquiryId, new InquiryEntity(), _notes);
var NotepadDTO = notepad.FromEntityToDTO();
Assert.NotNull(NotepadDTO);
Assert.IsType<NotepadDTO>(NotepadDTO);
Assert.Equal(0, NotepadDTO.Id);
Assert.Equal(_userId, NotepadDTO.UserId);
Assert.Equal(_inquiryId, NotepadDTO.InquiryId);
Assert.Equal(_notes, NotepadDTO.Notes);
NotepadEntity notepad = new NotepadEntity{Id = _id, User = new UserEntity(),InquiryId = _inquiryId,Inquiry = new InquiryEntity(),Notes = _notes};
var NotepadDto = notepad.FromEntityToDto();
Assert.NotNull(NotepadDto);
Assert.IsType<NotepadDto>(NotepadDto);
Assert.Equal(1, NotepadDto.Id);
Assert.Equal(0, NotepadDto.UserId);
Assert.Equal(2, NotepadDto.InquiryId);
Assert.Equal(_notes, NotepadDto.Notes);
}
[Fact]
public void TestEntityToModel()
{
NotepadEntity notepad = new NotepadEntity(_id,new UserEntity(),_inquiryId,new InquiryEntity(),_notes);
NotepadEntity notepad = new NotepadEntity { Id = _id, User = new UserEntity(), InquiryId = _inquiryId, Inquiry = new InquiryEntity(), Notes = _notes };
var notepadMod = notepad.FromEntityToModel();
Assert.NotNull(notepadMod);
Assert.IsType<Notepad>(notepadMod);
Assert.Equal(0, notepadMod.Id);
Assert.Equal(_userId, notepadMod.UserId);
Assert.Equal(1, notepadMod.Id);
Assert.Equal(0, notepadMod.UserId);
Assert.Equal(2, notepadMod.InquiryId);
Assert.Equal(_notes, notepadMod.Notes);
}
@ -84,14 +84,14 @@ namespace TestEF.Mapper
public void TestModelToDto()
{
Notepad notepad = new Notepad(_id,_userId,_inquiryId,_notes);
var NotepadDTO = notepad.FromModelToDTO();
Assert.NotNull(NotepadDTO);
Assert.IsType<NotepadDTO>(NotepadDTO);
Assert.Equal(_id, NotepadDTO.Id);
Assert.Equal(_userId, NotepadDTO.UserId);
Assert.Equal(_inquiryId, NotepadDTO.InquiryId);
Assert.Equal(_notes, NotepadDTO.Notes);
var NotepadDto = notepad.FromModelToDto();
Assert.NotNull(NotepadDto);
Assert.IsType<NotepadDto>(NotepadDto);
Assert.Equal(_id, NotepadDto.Id);
Assert.Equal(_userId, NotepadDto.UserId);
Assert.Equal(_inquiryId, NotepadDto.InquiryId);
Assert.Equal(_notes, NotepadDto.Notes);
}
[Fact]
@ -102,9 +102,9 @@ namespace TestEF.Mapper
Assert.NotNull(notepadEntity);
Assert.IsType<NotepadEntity>(notepadEntity);
Assert.Equal(0, notepadEntity.Id);
Assert.Equal(1, notepadEntity.Id);
Assert.Equal(_userId, notepadEntity.UserId);
Assert.Equal(1, notepadEntity.InquiryId);
Assert.Equal(0, notepadEntity.InquiryId);
Assert.Equal(_notes, notepadEntity.Notes);
}
}

@ -26,8 +26,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
ParagraphDTO paragraph = new ParagraphDTO(_id,_title,_content,_info,_query,_comment,_lessonId);
var paragrahEntity = paragraph.FromDTOToEntity();
ParagraphDto paragraph = new ParagraphDto(_id,_title,_content,_info,_query,_comment,_lessonId);
var paragrahEntity = paragraph.FromDtoToEntity();
Assert.NotNull(paragrahEntity);
Assert.IsType<ParagraphEntity>(paragrahEntity);
@ -45,8 +45,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
ParagraphDTO paragraph = new ParagraphDTO(_id, _title, _content, _info, _query, _comment, _lessonId);
var paragraphMod = paragraph.FromDTOToModel();
ParagraphDto paragraph = new ParagraphDto(_id, _title, _content, _info, _query, _comment, _lessonId);
var paragraphMod = paragraph.FromDtoToModel();
Assert.NotNull(paragraphMod);
Assert.IsType<Paragraph>(paragraphMod);
@ -61,11 +61,11 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
ParagraphEntity paragraph = new ParagraphEntity(_id, _title, _content, _info, _query, _comment, _lessonId);
var paragraphDTO = paragraph.FromEntityToDTO();
ParagraphEntity paragraph = new ParagraphEntity{Id = _id,Title = _title,Content = _content,Info = _info,Query = _query,Comment = _comment,LessonId = _lessonId};
var paragraphDTO = paragraph.FromEntityToDto();
Assert.NotNull(paragraphDTO);
Assert.IsType<ParagraphDTO>(paragraphDTO);
Assert.IsType<ParagraphDto>(paragraphDTO);
Assert.Equal(1, paragraphDTO.Id);
Assert.Equal(_title, paragraphDTO.Title);
Assert.Equal(_content, paragraphDTO.Content);
@ -79,7 +79,7 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToModel()
{
ParagraphEntity paragraph = new ParagraphEntity(_id, _title, _content, _info, _query, _comment, _lessonId);
ParagraphEntity paragraph = new ParagraphEntity { Id = _id, Title = _title, Content = _content, Info = _info, Query = _query, Comment = _comment, LessonId = _lessonId };
var paragrahMod = paragraph.FromEntityToModel();
Assert.NotNull(paragrahMod);
@ -97,10 +97,10 @@ namespace TestEF.Mapper
public void TestModelToDto()
{
Paragraph paragraph = new Paragraph(_id, _title, _content, _info, _query, _comment, _lessonId);
var paragrahDTO = paragraph.FromModelToDTO();
var paragrahDTO = paragraph.FromModelToDto();
Assert.NotNull(paragrahDTO);
Assert.IsType<ParagraphDTO>(paragrahDTO);
Assert.IsType<ParagraphDto>(paragrahDTO);
Assert.Equal(1, paragrahDTO.Id);
Assert.Equal(_title, paragrahDTO.Title);
Assert.Equal(_content, paragrahDTO.Content);
@ -114,14 +114,12 @@ namespace TestEF.Mapper
[Fact]
public void TestModelToEntity()
{
ParagraphEntity paragraph = new ParagraphEntity(_id, _title, _content, _info, _query, _comment, _lessonId);
var paragrahEntity = paragraph.FromEntityToDTO();
Paragraph paragraph = new Paragraph(_id, _title, _content, _info, _query, _comment, _lessonId);
var paragrahEntity = paragraph.FromModelToEntity();
Assert.NotNull(paragrahEntity);
Assert.IsType<ParagraphDTO>(paragrahEntity);
Assert.IsType<ParagraphEntity>(paragrahEntity);
Assert.Equal(1, paragrahEntity.Id);
Assert.Equal(_title, paragrahEntity.Title);
Assert.Equal(_content, paragrahEntity.Content);
Assert.Equal(_info, paragrahEntity.Info);
Assert.Equal(_query, paragrahEntity.Query);
Assert.Equal(_comment, paragrahEntity.Comment);

@ -25,8 +25,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
SolutionDTO solution = new SolutionDTO(_ownerId,_murdererFirstName,_murdererLastName,_murderPlace,_murderWeapon,_explanation);
var solutionEntity = solution.FromDTOToEntity();
SolutionDto solution = new SolutionDto(_ownerId,_murdererFirstName,_murdererLastName,_murderPlace,_murderWeapon,_explanation);
var solutionEntity = solution.FromDtoToEntity();
Assert.NotNull(solutionEntity);
Assert.IsType<SolutionEntity>(solutionEntity);
@ -42,8 +42,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
SolutionDTO solution = new SolutionDTO(_ownerId, _murdererFirstName, _murdererLastName, _murderPlace, _murderWeapon, _explanation);
var solutionMod = solution.FromDTOToModel();
SolutionDto solution = new SolutionDto(_ownerId, _murdererFirstName, _murdererLastName, _murderPlace, _murderWeapon, _explanation);
var solutionMod = solution.FromDtoToModel();
Assert.NotNull(solutionMod);
Assert.IsType<Solution>(solutionMod);
@ -59,11 +59,11 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
SolutionEntity solution = new SolutionEntity(_ownerId, _murdererFirstName, _murdererLastName, _murderPlace, _murderWeapon, _explanation);
var solutionDto = solution.FromEntityToDTO();
SolutionEntity solution = new SolutionEntity{OwnerId = _ownerId,MurdererFirstName = _murdererFirstName,MurdererLastName = _murdererLastName,MurderPlace = _murderPlace,MurderWeapon = _murderWeapon,Explaination = _explanation};
var solutionDto = solution.FromEntityToDto();
Assert.NotNull(solutionDto);
Assert.IsType<SolutionDTO>(solutionDto);
Assert.IsType<SolutionDto>(solutionDto);
Assert.Equal(_ownerId, solutionDto.OwnerId);
Assert.Equal(_murdererFirstName, solutionDto.MurdererFirstName);
Assert.Equal(_murdererLastName, solutionDto.MurdererLastName);
@ -75,7 +75,7 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToModel()
{
SolutionEntity solution = new SolutionEntity(_ownerId, _murdererFirstName, _murdererLastName, _murderPlace, _murderWeapon, _explanation);
SolutionEntity solution = new SolutionEntity { OwnerId = _ownerId, MurdererFirstName = _murdererFirstName, MurdererLastName = _murdererLastName, MurderPlace = _murderPlace, MurderWeapon = _murderWeapon, Explaination = _explanation };
var solutionMod = solution.FromEntityToModel();
Assert.NotNull(solutionMod);
@ -94,10 +94,10 @@ namespace TestEF.Mapper
public void TestModelToDto()
{
Solution solution = new Solution(_ownerId, _murdererFirstName, _murdererLastName, _murderPlace, _murderWeapon, _explanation);
var solutionDto = solution.FromModelToDTO();
var solutionDto = solution.FromModelToDto();
Assert.NotNull(solutionDto);
Assert.IsType<SolutionDTO>(solutionDto);
Assert.IsType<SolutionDto>(solutionDto);
Assert.Equal(_ownerId, solutionDto.OwnerId);
Assert.Equal(_murdererFirstName, solutionDto.MurdererFirstName);
Assert.Equal(_murdererLastName, solutionDto.MurdererLastName);

@ -20,8 +20,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
SuccessDTO success = new SuccessDTO(_userId, _inquiryId, _isFinished);
var successEntity = success.FromDTOToEntity();
SuccessDto success = new SuccessDto(_userId, _inquiryId, _isFinished);
var successEntity = success.FromDtoToEntity();
Assert.NotNull(successEntity);
Assert.IsType<SuccessEntity>(successEntity);
@ -35,8 +35,8 @@ namespace TestEF.Mapper
public void TestDtoToModel()
{
SuccessDTO success = new SuccessDTO(_userId, _inquiryId, _isFinished);
var successMod = success.FromDTOToModel();
SuccessDto success = new SuccessDto(_userId, _inquiryId, _isFinished);
var successMod = success.FromDtoToModel();
Assert.NotNull(successMod);
Assert.IsType<Success>(successMod);
@ -49,11 +49,11 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
SuccessEntity success = new SuccessEntity(_userId, _inquiryId, _isFinished);
var successDto = success.FromEntityToDTO();
SuccessEntity success = new SuccessEntity{UserId = _userId,InquiryId = _inquiryId,IsFinished = _isFinished};
var successDto = success.FromEntityToDto();
Assert.NotNull(successDto);
Assert.IsType<SuccessDTO>(successDto);
Assert.IsType<SuccessDto>(successDto);
Assert.Equal(1, successDto.UserId);
Assert.Equal(2, successDto.InquiryId);
Assert.True(successDto.IsFinished);
@ -62,7 +62,7 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToModel()
{
SuccessEntity success = new SuccessEntity(_userId, _inquiryId, _isFinished);
SuccessEntity success = new SuccessEntity { UserId = _userId, InquiryId = _inquiryId, IsFinished = _isFinished };
var successMod = success.FromEntityToModel();
Assert.NotNull(successMod);
@ -79,10 +79,10 @@ namespace TestEF.Mapper
public void TestModelToDto()
{
Success success = new Success(_userId, _inquiryId, _isFinished);
var successDto = success.FromModelToDTO();
var successDto = success.FromModelToDto();
Assert.NotNull(successDto);
Assert.IsType<SuccessDTO>(successDto);
Assert.IsType<SuccessDto>(successDto);
Assert.Equal(1, successDto.UserId);
Assert.Equal(2, successDto.InquiryId);
Assert.True((bool)successDto.IsFinished);

@ -22,8 +22,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToEntity()
{
UserDTO user = new UserDTO(_userId,_username,_password,_email,_isAdmin);
var userEntity = user.FromDTOToEntity();
UserDto user = new UserDto(_userId,_username,_password,_email,_isAdmin);
var userEntity = user.FromDtoToEntity();
Assert.NotNull(userEntity);
Assert.IsType<UserEntity>(userEntity);
@ -38,8 +38,8 @@ namespace TestEF.Mapper
[Fact]
public void TestDtoToModel()
{
UserDTO user = new UserDTO(_userId, _username, _password, _email, _isAdmin);
var userMod = user.FromDTOToModel();
UserDto user = new UserDto(_userId, _username, _password, _email, _isAdmin);
var userMod = user.FromDtoToModel();
Assert.NotNull(userMod);
Assert.IsType<User>(userMod);
@ -54,11 +54,11 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToDto()
{
UserEntity user = new UserEntity(_userId, _username, _password, _email, _isAdmin);
var userEntity = user.FromEntityToDTO();
UserEntity user = new UserEntity{Id = _userId,Username = _username,Password = _password, Email = _email,IsAdmin = _isAdmin};
var userEntity = user.FromEntityToDto();
Assert.NotNull(userEntity);
Assert.IsType<UserDTO>(userEntity);
Assert.IsType<UserDto>(userEntity);
Assert.Equal(1, userEntity.Id);
Assert.Equal("Username", userEntity.Username);
Assert.Equal("password", userEntity.Password);
@ -69,7 +69,7 @@ namespace TestEF.Mapper
[Fact]
public void TestEntityToModel()
{
UserEntity user = new UserEntity(_userId, _username, _password, _email, _isAdmin);
UserEntity user = new UserEntity { Id = _userId, Username = _username, Password = _password, Email = _email, IsAdmin = _isAdmin };
var userMod = user.FromEntityToModel();
Assert.NotNull(userMod);
@ -87,10 +87,10 @@ namespace TestEF.Mapper
public void TestModelToDto()
{
User user = new User(_userId, _username, _password, _email, _isAdmin);
var userDto = user.FromModelToDTO();
var userDto = user.FromModelToDto();
Assert.NotNull(userDto);
Assert.IsType<UserDTO>(userDto);
Assert.IsType<UserDto>(userDto);
Assert.Equal(1, userDto.Id);
Assert.Equal("Username", userDto.Username);
Assert.Equal("password", userDto.Password);

Loading…
Cancel
Save