Dependencies: Updates to .NET 10 RC and NPoco 6.1 (#20184)
* Update to .NET 10 RC 1. * Update NPoco to 6.1.0 and resolve binary breaking changes. * Resolved behavioural breaking changes (need to use List<string> over string[] for Contains). * Update dependency on NPoco.SqlServer. * Further fixes from manual testing. * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fixed comment typos. * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fixed nullability issue. * Fix database creation issue * Fix missing to list --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: nikolajlauridsen <nikolajlauridsen@protonmail.ch>
This commit is contained in:
@@ -2094,7 +2094,8 @@ internal sealed class ContentServiceTests : UmbracoIntegrationTestWithContent
|
||||
|
||||
var user = await UserService.GetAsync(Constants.Security.SuperUserKey);
|
||||
var userGroup = await UserGroupService.GetAsync(user.Groups.First().Alias);
|
||||
Assert.IsNotNull(NotificationService.CreateNotification(user, content1, "X"));
|
||||
NotificationService.TryCreateNotification(user, content1, "X", out Notification? notification);
|
||||
Assert.IsNotNull(notification);
|
||||
|
||||
ContentService.SetPermission(content1, "A", new[] { userGroup.Id });
|
||||
var updateDomainResult = await DomainService.UpdateDomainsAsync(
|
||||
|
||||
@@ -310,7 +310,7 @@ internal sealed class MediaRepositoryTest : UmbracoIntegrationTest
|
||||
repository.Save(folder);
|
||||
}
|
||||
|
||||
int[] types = { 1031 };
|
||||
var types = new List<int> { 1031 };
|
||||
var query = provider.CreateQuery<IMedia>().Where(x => types.Contains(x.ContentTypeId));
|
||||
var result = repository.Get(query);
|
||||
|
||||
|
||||
@@ -6,8 +6,10 @@ using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Models.Entities;
|
||||
using Umbraco.Cms.Core.Models.Membership;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
|
||||
using Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement;
|
||||
using Umbraco.Cms.Infrastructure.Scoping;
|
||||
@@ -45,7 +47,8 @@ internal sealed class NotificationsRepositoryTest : UmbracoIntegrationTest
|
||||
var entity = Mock.Of<IEntity>(e => e.Id == node.NodeId);
|
||||
var user = Mock.Of<IUser>(e => e.Id == node.UserId);
|
||||
|
||||
var notification = repo.CreateNotification(user, entity, "A");
|
||||
repo.TryCreateNotification(user, entity, "A", out Notification? notification);
|
||||
Assert.IsNotNull(notification);
|
||||
|
||||
Assert.AreEqual("A", notification.Action);
|
||||
Assert.AreEqual(node.NodeId, notification.EntityId);
|
||||
@@ -94,7 +97,7 @@ internal sealed class NotificationsRepositoryTest : UmbracoIntegrationTest
|
||||
};
|
||||
var result = ScopeAccessor.AmbientScope.Database.Insert(node);
|
||||
var entity = Mock.Of<IEntity>(e => e.Id == node.NodeId);
|
||||
var notification = repo.CreateNotification(i % 2 == 0 ? userAdmin : userNew, entity, i.ToString(CultureInfo.InvariantCulture));
|
||||
repo.TryCreateNotification(i % 2 == 0 ? userAdmin : userNew, entity, i.ToString(CultureInfo.InvariantCulture), out Notification? notification);
|
||||
}
|
||||
|
||||
var notifications = repo.GetUserNotifications(userAdmin);
|
||||
@@ -157,7 +160,7 @@ internal sealed class NotificationsRepositoryTest : UmbracoIntegrationTest
|
||||
};
|
||||
ScopeAccessor.AmbientScope.Database.Insert(userDto);
|
||||
var userNew = Mock.Of<IUser>(e => e.Id == userDto.Id);
|
||||
var notification = repo.CreateNotification(userNew, i % 2 == 0 ? entity1 : entity2, i.ToString(CultureInfo.InvariantCulture));
|
||||
repo.TryCreateNotification(userNew, i % 2 == 0 ? entity1 : entity2, i.ToString(CultureInfo.InvariantCulture), out Notification? notification);
|
||||
}
|
||||
|
||||
var notifications = repo.GetEntityNotifications(entity1);
|
||||
@@ -220,7 +223,7 @@ internal sealed class NotificationsRepositoryTest : UmbracoIntegrationTest
|
||||
};
|
||||
ScopeAccessor.AmbientScope.Database.Insert(userDto);
|
||||
var userNew = Mock.Of<IUser>(e => e.Id == userDto.Id);
|
||||
var notification = repo.CreateNotification(userNew, i % 2 == 0 ? entity1 : entity2, i.ToString(CultureInfo.InvariantCulture));
|
||||
repo.TryCreateNotification(userNew, i % 2 == 0 ? entity1 : entity2, i.ToString(CultureInfo.InvariantCulture), out Notification? notification);
|
||||
}
|
||||
|
||||
var delCount = repo.DeleteNotifications(entity1);
|
||||
@@ -269,7 +272,7 @@ internal sealed class NotificationsRepositoryTest : UmbracoIntegrationTest
|
||||
};
|
||||
var result = ScopeAccessor.AmbientScope.Database.Insert(node);
|
||||
var entity = Mock.Of<IEntity>(e => e.Id == node.NodeId);
|
||||
var notification = repo.CreateNotification(i % 2 == 0 ? userAdmin : userNew, entity, i.ToString(CultureInfo.InvariantCulture));
|
||||
repo.TryCreateNotification(i % 2 == 0 ? userAdmin : userNew, entity, i.ToString(CultureInfo.InvariantCulture), out Notification? notification);
|
||||
}
|
||||
|
||||
var delCount = repo.DeleteNotifications(userAdmin);
|
||||
|
||||
@@ -979,7 +979,7 @@ internal sealed class EntityServiceTests : UmbracoIntegrationTest
|
||||
|
||||
// Apply a filter that excludes the child at index 1. We'd expect to not get this, but
|
||||
// get still get one previous sibling, i.e. the entity at index 0.
|
||||
Guid[] keysToExclude = [children[1].Key];
|
||||
var keysToExclude = new List<Guid> { children[1].Key };
|
||||
IQuery<IUmbracoEntity> filter = ScopeProvider.CreateQuery<IUmbracoEntity>().Where(x => !keysToExclude.Contains(x.Key));
|
||||
|
||||
var target = children[2];
|
||||
|
||||
@@ -100,13 +100,15 @@ internal sealed class MediaServiceTests : UmbracoIntegrationTest
|
||||
var provider = ScopeProvider;
|
||||
using (provider.CreateScope())
|
||||
{
|
||||
var filter = provider.CreateQuery<IMedia>()
|
||||
.Where(x => new List<int> { mediaType1.Id, mediaType2.Id }.Contains(x.ContentTypeId));
|
||||
|
||||
var result = MediaService.GetPagedChildren(
|
||||
-1,
|
||||
0,
|
||||
11,
|
||||
out var total,
|
||||
provider.CreateQuery<IMedia>()
|
||||
.Where(x => new[] { mediaType1.Id, mediaType2.Id }.Contains(x.ContentTypeId)),
|
||||
filter,
|
||||
Ordering.By("SortOrder"));
|
||||
Assert.AreEqual(11, result.Count());
|
||||
Assert.AreEqual(20, total);
|
||||
@@ -116,8 +118,7 @@ internal sealed class MediaServiceTests : UmbracoIntegrationTest
|
||||
1,
|
||||
11,
|
||||
out total,
|
||||
provider.CreateQuery<IMedia>()
|
||||
.Where(x => new[] { mediaType1.Id, mediaType2.Id }.Contains(x.ContentTypeId)),
|
||||
filter,
|
||||
Ordering.By("SortOrder"));
|
||||
Assert.AreEqual(9, result.Count());
|
||||
Assert.AreEqual(20, total);
|
||||
|
||||
Reference in New Issue
Block a user