|
|
|
@ -0,0 +1,96 @@
|
|
|
|
|
using Dto;
|
|
|
|
|
using Entities;
|
|
|
|
|
using Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Shared.Mapper;
|
|
|
|
|
|
|
|
|
|
namespace TestEF.Mapper
|
|
|
|
|
{
|
|
|
|
|
public class BlackListMapperUnitTest
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private const string _email = "email@email.com";
|
|
|
|
|
private DateOnly _date = new DateOnly(2024,12,21) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestDtoToEntity()
|
|
|
|
|
{
|
|
|
|
|
BlackListDTO blacklist = new BlackListDTO(_email,_date);
|
|
|
|
|
var blackListEntity = blacklist.FromDTOToEntity();
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(blackListEntity);
|
|
|
|
|
Assert.IsType<BlackListEntity>(blackListEntity);
|
|
|
|
|
Assert.Equal(_date, blackListEntity.ExpirationDate);
|
|
|
|
|
Assert.Equal(_email, blackListEntity.Email);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestDtoToModel()
|
|
|
|
|
{
|
|
|
|
|
BlackListDTO blacklist = new BlackListDTO(_email,_date);
|
|
|
|
|
var blackListMod = blacklist.FromDTOToModel();
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(blackListMod);
|
|
|
|
|
Assert.IsType<BlackList>(blackListMod);
|
|
|
|
|
Assert.Equal(_date, blackListMod.ExpirationDate);
|
|
|
|
|
Assert.Equal(_email, blackListMod.Email);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestEntityToDto()
|
|
|
|
|
{
|
|
|
|
|
BlackListEntity blacklist = new BlackListEntity(_email,_date);
|
|
|
|
|
var blackListDto = blacklist.FromEntityToDTO();
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
var blackListMod = blacklist.FromEntityToModel();
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(blackListMod);
|
|
|
|
|
Assert.IsType<BlackList>(blackListMod);
|
|
|
|
|
Assert.Equal(_date, blackListMod.ExpirationDate);
|
|
|
|
|
Assert.Equal(_email, blackListMod.Email);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestModelToDto()
|
|
|
|
|
{
|
|
|
|
|
BlackList blacklist = new BlackList(_email,_date);
|
|
|
|
|
var BlackListDto = blacklist.FromModelToDTO();
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(BlackListDto);
|
|
|
|
|
Assert.IsType<BlackListDTO>(BlackListDto);
|
|
|
|
|
Assert.Equal(_date, BlackListDto.ExpirationDate);
|
|
|
|
|
Assert.Equal(_email, BlackListDto.Email);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestModelToEntity()
|
|
|
|
|
{
|
|
|
|
|
BlackList blacklist = new BlackList(_email,_date);
|
|
|
|
|
var blackListEntity = blacklist.FromModelToEntity();
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(blackListEntity);
|
|
|
|
|
Assert.IsType<BlackListEntity>(blackListEntity);
|
|
|
|
|
Assert.Equal(_date, blackListEntity.ExpirationDate);
|
|
|
|
|
Assert.Equal(_email, blackListEntity.Email);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|