public void RegisterSettings_Should_Accept_Types_Not_Annotated_With_Anything() { _registry.RegisterSettings <SettingsPocoWithNoDisplayNameAttributes>(); var entries = _registry.GetEntries(); Assert.NotNull(entries); var entry = entries.Single(); var typeName = nameof(SettingsPocoWithNoDisplayNameAttributes); var propertyName = nameof(SettingsPocoWithNoDisplayNameAttributes.Anything); Assert.Equal(typeName, entry.Section); Assert.Equal($"{typeName}.{propertyName}", entry.Name); Assert.Equal(propertyName, entry.Description); }
public async Task <OrganizationSettingDto[]> List(int organizationId, CancellationToken cancellationToken) { await _organizationRetrievalService .GetOrganizationByIdAsync(organizationId, cancellationToken : cancellationToken); // to check for org existence var settings = await _organizationSettingsCache .GetAllSettingsForOrganizationAsync(organizationId); var values = settings.ToDictionary( s => s.Name, s => s.Value); return(_organizationSettingsRegistry.GetEntries() .OrderBy(e => e.Section) .ThenBy(e => e.Name) .Select(e => new OrganizationSettingDto(e) { Value = values.ContainsKey(e.Name) ? values[e.Name] : null }).ToArray()); }