using System.Diagnostics.CodeAnalysis; using System.Net.Http.Json; using Microsoft.AspNetCore.Mvc.Testing; using NetAdmin.AdmServer.Host; using NetAdmin.Application.Modules; using NetAdmin.Domain.Dto.Dependency; using NetAdmin.Domain.Dto.Sys.Api; using NetAdmin.Domain.Dto.Sys.Cache; using NetAdmin.Domain.Dto.Sys.Config; using NetAdmin.Domain.Dto.Sys.Tool; using NetAdmin.SysComponent.Application.Modules.Sys; using NetAdmin.Tests; using Xunit; using Xunit.Abstractions; namespace NetAdmin.AdmServer.Tests; /// /// 所有测试 /// [SuppressMessage("Usage", "xUnit1028:Test method must have valid return type")] public class AllTests(WebApplicationFactory factory, ITestOutputHelper testOutputHelper) : WebApiTestBase(factory, testOutputHelper), IToolsModule, ICacheModule, IApiModule, IConfigModule { /// public Task BulkDeleteAsync(BulkReq req) { throw new NotImplementedException(); } /// [Fact] public async Task CacheStatisticsAsync() { var rsp = await PostAsync("/api/sys/cache/cache.statistics", null).ConfigureAwait(true); Assert.Equal(HttpStatusCode.OK, rsp.StatusCode); return default; } /// public Task CountAsync(QueryReq req) { throw new NotImplementedException(); } /// public Task CountAsync(QueryReq req) { throw new NotImplementedException(); } /// public Task CreateAsync(CreateConfigReq req) { throw new NotImplementedException(); } /// public Task CreateAsync(CreateApiReq req) { throw new NotImplementedException(); } /// public Task DeleteAsync(DelReq req) { throw new NotImplementedException(); } /// public Task ExistAsync(QueryReq req) { throw new NotImplementedException(); } /// public Task ExistAsync(QueryReq req) { throw new NotImplementedException(); } /// [InlineData(default)] [Theory] public async Task> GetAllEntriesAsync(PagedQueryReq req) { var rsp = await PostAsync("/api/sys/cache/get.all.entries" , JsonContent.Create(new PagedQueryReq())) .ConfigureAwait(true); Assert.Equal(HttpStatusCode.OK, rsp.StatusCode); return default; } /// public Task GetAsync(QueryConfigReq req) { throw new NotImplementedException(); } /// public Task GetAsync(QueryApiReq req) { throw new NotImplementedException(); } /// public Task GetChangeLogAsync() { throw new NotImplementedException(); } /// public Task GetLatestConfigAsync() { throw new NotImplementedException(); } /// public Task> GetModulesAsync() { throw new NotImplementedException(); } /// [Fact] public async Task GetServerUtcTimeAsync() { var response = await PostAsync("/api/sys/tools/get.server.utc.time", null).ConfigureAwait(true); Assert.Equal(HttpStatusCode.OK, response.StatusCode); return default; } /// [Fact] public async Task GetVersionAsync() { var response = await PostAsync("/api/sys/tools/version", null).ConfigureAwait(true); Assert.Equal(HttpStatusCode.OK, response.StatusCode); return default; } /// public Task> PagedQueryAsync(PagedQueryReq req) { throw new NotImplementedException(); } /// public Task> PagedQueryAsync(PagedQueryReq req) { throw new NotImplementedException(); } /// public Task> QueryAsync(QueryReq req) { throw new NotImplementedException(); } /// public Task> QueryAsync(QueryReq req) { throw new NotImplementedException(); } /// [Fact] public async Task SyncAsync() { var response = await PostAsync("/api/sys/api/sync", null).ConfigureAwait(true); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } /// public Task UpdateAsync(UpdateConfigReq req) { throw new NotImplementedException(); } /// public Task UpdateAsync(NopReq req) { throw new NotImplementedException(); } }