Refactoring: Add extension method for retrieval of language ISO codes if that's all we need (#20324)
* Retrieve only ISO codes from the database rather than full language objects if that's all we need. * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Removed repository updates and migrated the new service method to an extension method. * Fixed issue after merge. * Removed left-over using --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Extensions;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Cms.Core.Services.OperationStatus;
|
||||
@@ -28,6 +29,14 @@ internal sealed class LanguageServiceTests : UmbracoIntegrationTest
|
||||
Assert.That(languages.Count(), Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Can_Get_All_Language_Iso_Codes()
|
||||
{
|
||||
var isoCodes = await LanguageService.GetAllIsoCodesAsync();
|
||||
Assert.That(isoCodes.Count(), Is.EqualTo(3));
|
||||
Assert.AreEqual("da-DK,en-GB,en-US", string.Join(",", isoCodes.OrderBy(x => x)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Can_GetLanguageByIsoCode()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user