test/UnitTest/Bootstrap.Admin/Api/CategoryTest.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using Bootstrap.DataAccess;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Json;
using Xunit;
namespace Bootstrap.Admin.Api
{
public class CategoryTest : ControllerTest
{
public CategoryTest(BALoginWebHost factory) : base(factory, "api/Category") { }
[Fact]
public async void DictCategorys_Ok()
{
var cates = await Client.GetFromJsonAsync<IEnumerable<string>>("RetrieveDictCategorys");
Assert.NotEmpty(cates);
}
[Fact]
public async void Menus_Ok()
{
var cates = await Client.GetFromJsonAsync<IEnumerable<string>>("RetrieveMenus");
Assert.NotEmpty(cates);
}
[Fact]
public async void ParentMenus_Ok()
{
var cates = await Client.GetFromJsonAsync<IEnumerable<string>>("RetrieveParentMenus");
Assert.NotEmpty(cates);
}
[Fact]
public async void ValidateMenuBySubMenu_Ok()
{
var id = MenuHelper.RetrieveAllMenus("Admin").First(m => m.Name == "个人中心").Id;
var cates = await Client.GetFromJsonAsync<bool>($"ValidateMenuBySubMenu/{id}");
Assert.False(cates);
id = MenuHelper.RetrieveAllMenus("Admin").First(m => m.Name == "后台管理").Id;
cates = await Client.GetFromJsonAsync<bool>($"ValidateMenuBySubMenu/{id}");
Assert.True(cates);
}
[Fact]
public async void ValidateParentMenuById_Ok()
{
var id = MenuHelper.RetrieveAllMenus("Admin").First(m => m.Name == "个人中心").Id;
var cates = await Client.GetFromJsonAsync<bool>($"ValidateParentMenuById/{id}");
Assert.True(cates);
var subId = MenuHelper.RetrieveAllMenus("Admin").First(m => m.ParentId == id).Id;
cates = await Client.GetFromJsonAsync<bool>($"ValidateParentMenuById/{subId}");
Assert.False(cates);
}
后面还有 2 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
