From 883ad7d2562acc942cceea93c7dde43edd14ef73 Mon Sep 17 00:00:00 2001 From: Adam Hearn Date: Thu, 15 Jul 2021 01:05:54 +0100 Subject: [PATCH] Added integration test for MemberService::CreateWithIdentity to highlight that whilst the method does not generate an error, no member is persisted --- .../Services/MemberServiceTests.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs index eb10bb010a..0ef94ce9f1 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs @@ -3,12 +3,12 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading; using NPoco; using NUnit.Framework; using Umbraco.Cms.Core; -using Umbraco.Cms.Core.Composing; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Models.Entities; using Umbraco.Cms.Core.Models.Membership; @@ -1306,5 +1306,23 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services Assert.IsTrue(found.IsApproved); } + + [Test] + public void Can_CreateWithIdentity() + { + // Arrange + IMemberType memberType = MemberTypeBuilder.CreateSimpleMemberType(); + MemberTypeService.Save(memberType); + string username = Path.GetRandomFileName(); + + // Act + IMember member = MemberService.CreateMemberWithIdentity(username, $"{username}@domain.email", Path.GetFileNameWithoutExtension(username), memberType); + IMember found = MemberService.GetById(member.Id); + + // Assert + Assert.IsNotNull(member, "Verifying a member instance has been created"); + Assert.IsNotNull(found, "Verifying the created member instance has been retrieved"); + Assert.IsTrue(found?.Name == member?.Name, "Verifying the retrieved member instance has the expected name"); + } } }