feat: 添加单元测试web端

This commit is contained in:
陈淳
2024-01-19 18:08:11 +08:00
parent 226b4ce722
commit 1d777f8704
4 changed files with 71 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Shouldly;
using Xunit;
namespace Yi.Abp.Test.Demo
{
public class HttpUser_Test : YiAbpTestWebBase
{
[Fact]
public void Http_Test()
{
var httpContext = GetRequiredService<IHttpContextAccessor>();
httpContext.HttpContext.Request.Path.ToString().ShouldBe("/test");
}
}
}

View File

@@ -0,0 +1,18 @@
using Shouldly;
using Xunit;
using Yi.Framework.Rbac.Application.Contracts.IServices;
using Yi.Framework.Rbac.Domain.Shared.Consts;
namespace Yi.Abp.Test.Demo
{
public class User_Test : YiAbpTestBase
{
[Fact]
public async Task Get_User_List_Test()
{
var service = GetRequiredService<IUserService>();
var user = await service.GetListAsync(new Framework.Rbac.Application.Contracts.Dtos.User.UserGetListInputVo { UserName = UserConst.Admin });
user.ShouldNotBeNull();
}
}
}