Admin.Core/src/tests/ZhonTai.Tests/Controllers/ApiControllerTest.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using ZhonTai.Admin.Services.Api.Dto;
using ZhonTai.Admin.Core.Dto;
using ZhonTai.Admin.Domain.Api.Dto;

namespace ZhonTai.Tests.Controllers;

public class ApiControllerTest : BaseControllerTest
{
    public ApiControllerTest() : base()
    {
    }

    [Fact]
    public async Task Get()
    {
        var res = await GetResult<ResultOutput<ApiGetOutput>>("/api/admin/api/get?id=161227167658053");
        Assert.True(res.Success);
    }

    [Fact]
    public async Task GetList()
    {
        var res = await GetResult<ResultOutput<List<ApiListOutput>>>("/api/admin/api/get-list?key=接口管理");
        Assert.True(res.Success);
    }

    [Fact]
    public async Task GetPage()
    {
        await Login();
        var input = new PageInput<ApiGetPageDto>
        {
            CurrentPage = 1,
            PageSize = 20,
            Filter = new ApiGetPageDto
            {
                Label = "接口管理"
            }
        };

        var res = await PostResult($"/api/admin/api/get-page", input);
        Assert.True(res.Success);
    }

    [Fact]
    public async Task Add()
    {
        var input = new ApiAddInput
        {
           Label = "新接口",
           Path = "/api/admin/api/newapi",
           HttpMethods = "post"
        };

        var res = await PostResult($"/api/admin/api/add", input);
        Assert.True(res.Success);
    }
后面还有 16 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。