69 lines
1.5 KiB
C#
69 lines
1.5 KiB
C#
|
using Bunny.Common.Utils.Net;
|
|||
|
using Bunny.Dao.Dto.Email;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using NUnit.Framework;
|
|||
|
|
|||
|
namespace Bunny.Test.Until;
|
|||
|
|
|||
|
public class NetUtilTest
|
|||
|
{
|
|||
|
[Test]
|
|||
|
public void NetTest1()
|
|||
|
{
|
|||
|
var emailTemplateDto = new EmailTemplateDto
|
|||
|
{
|
|||
|
Body = "test@example.com",
|
|||
|
Subject = "主题",
|
|||
|
TemplateName = "hjh"
|
|||
|
};
|
|||
|
|
|||
|
var emailUsersDto = new EmailUsersDto();
|
|||
|
|
|||
|
NetUtil.CopyProperties(emailTemplateDto, emailUsersDto);
|
|||
|
|
|||
|
Console.WriteLine(JsonConvert.SerializeObject(emailUsersDto));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[Test]
|
|||
|
public void Encryption32()
|
|||
|
{
|
|||
|
// Arrange
|
|||
|
var password = "1";
|
|||
|
|
|||
|
// Act
|
|||
|
var result = NetUtil.Encryption32(password);
|
|||
|
Console.WriteLine(result);
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void Encryption32Lower()
|
|||
|
{
|
|||
|
// Arrange
|
|||
|
var password = "1";
|
|||
|
|
|||
|
// Act
|
|||
|
var result = NetUtil.Encryption32Lower(password);
|
|||
|
Console.WriteLine(result);
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void GetProperties()
|
|||
|
{
|
|||
|
var emailTemplateDto = new EmailTemplateDto
|
|||
|
{
|
|||
|
Body = "test@example.com",
|
|||
|
Subject = "主题",
|
|||
|
TemplateName = "hjh"
|
|||
|
};
|
|||
|
|
|||
|
var propertyInfos = emailTemplateDto.GetType().GetProperties();
|
|||
|
|
|||
|
foreach (var propertyInfo in propertyInfos)
|
|||
|
{
|
|||
|
Console.WriteLine(propertyInfo.Name);
|
|||
|
Console.WriteLine(propertyInfo.GetValue(emailTemplateDto));
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|