using System; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Http.Modeling; using Volo.Abp.Modularity; using Volo.Abp.Testing; namespace Volo.Abp.Http.FluentValidation; public abstract class AbpHttpFluentValidationTestBase : AbpIntegratedTest where TStartupModule : IAbpModule { protected virtual async Task GetPropertyAsync(string propertyName) { var typeModel = await CreateTypeModelAsync(typeof(TDto)); return typeModel.Properties!.Single(x => x.Name == propertyName); } protected virtual async Task CreateTypeModelAsync(Type type) { var typeModel = TypeApiDescriptionModel.Create(type); var contributors = ServiceProvider.GetServices().ToArray(); foreach (var propertyModel in typeModel.Properties!) { var context = new PropertyApiDescriptionModelContributionContext(propertyModel, type); foreach (var contributor in contributors) { await contributor.ContributeAsync(context); } } return typeModel; } }