using CloudServicesCrud; using DynamicCrud.Tests.Fixtures; using Xunit; namespace DynamicCrud.Tests; public class GetFieldsTests : IClassFixture { private readonly DbContextFixture _fixture; public GetFieldsTests(DbContextFixture fixture) { _fixture = fixture; } [Theory] [InlineData("backup_restore", "velero_restore_name")] [InlineData("backup_operations", "operation")] public async Task GetFields_NewBackupModels_ExposesExpectedColumn(string modelName, string expectedColumn) { using var ctx = _fixture.CreateContext(); var service = new server.Services.DynamicCrudService(ctx); var response = await service.GetFields(new GetFieldsRequest { Model = modelName }, context: null!); Assert.True(response.Success, $"[{modelName}] {response.Message}"); Assert.NotEmpty(response.Fields); Assert.Contains(response.Fields, f => f.Column == expectedColumn); } [Fact] public async Task GetFields_UnknownModel_ReturnsFailure() { using var ctx = _fixture.CreateContext(); var service = new server.Services.DynamicCrudService(ctx); var response = await service.GetFields(new GetFieldsRequest { Model = "no_existe" }, context: null!); Assert.False(response.Success); } }