|
|
|
@ -0,0 +1,60 @@
|
|
|
|
|
using Dto;
|
|
|
|
|
using Entities;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Shared.Mapper;
|
|
|
|
|
using SQLitePCL;
|
|
|
|
|
|
|
|
|
|
namespace TestEF.Mapper
|
|
|
|
|
{
|
|
|
|
|
public class ParagraphMapperUnitTest
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private const int _id = 1;
|
|
|
|
|
private const string _title = "Title";
|
|
|
|
|
private const string _content = "Contenu";
|
|
|
|
|
|
|
|
|
|
private const string _info = "Info";
|
|
|
|
|
private const string _query = "Requête";
|
|
|
|
|
private const string _comment = "Comment";
|
|
|
|
|
private const int _lessonId = 2;
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestDtoToEntity()
|
|
|
|
|
{
|
|
|
|
|
ParagraphDTO paragraph = new ParagraphDTO(_id,_title,_content,_info,_query,_comment,_lessonId);
|
|
|
|
|
var paragrahEntity = paragraph.FromDTOToEntity();
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(paragrahEntity);
|
|
|
|
|
Assert.IsType<ParagraphEntity>(paragrahEntity);
|
|
|
|
|
Assert.Equal(1, paragraph.Id);
|
|
|
|
|
Assert.Equal(_title, paragraph.Title);
|
|
|
|
|
Assert.Equal(_content, paragraph.Content);
|
|
|
|
|
Assert.Equal(_info, paragraph.Info);
|
|
|
|
|
Assert.Equal(_query, paragraph.Query);
|
|
|
|
|
Assert.Equal(_comment, paragraph.Comment);
|
|
|
|
|
Assert.Equal(_lessonId, paragraph.LessonId);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestEntityToDto()
|
|
|
|
|
{
|
|
|
|
|
ParagraphEntity paragraph = new ParagraphEntity(_id, _title, _content, _info, _query, _comment, _lessonId);
|
|
|
|
|
var paragrahEntity = paragraph.FromEntityToDTO();
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(paragrahEntity);
|
|
|
|
|
Assert.IsType<ParagraphDTO>(paragrahEntity);
|
|
|
|
|
Assert.Equal(1, paragraph.Id);
|
|
|
|
|
Assert.Equal(_title, paragraph.Title);
|
|
|
|
|
Assert.Equal(_content, paragraph.Content);
|
|
|
|
|
Assert.Equal(_info, paragraph.Info);
|
|
|
|
|
Assert.Equal(_query, paragraph.Query);
|
|
|
|
|
Assert.Equal(_comment, paragraph.Comment);
|
|
|
|
|
Assert.Equal(_lessonId, paragraph.LessonId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|