From d4fadb03293c676c77f9ee2d572c7c30d4ec8a9c Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Tue, 12 Nov 2024 11:20:47 +0100 Subject: [PATCH 1/8] Declare nullability on properties after changes in Profile API --- .../Models/ContactPoints/UserContactPoints.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs b/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs index 38b058da..4b15c602 100644 --- a/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs +++ b/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs @@ -8,12 +8,12 @@ public class UserContactPoints /// /// Gets or sets the ID of the user /// - public int UserId { get; set; } + public int? UserId { get; set; } /// /// Gets or sets the national identityt number of the user /// - public string NationalIdentityNumber { get; set; } = string.Empty; + public string? NationalIdentityNumber { get; set; } /// /// Gets or sets a boolean indicating whether the user has reserved themselves from electronic communication @@ -23,12 +23,12 @@ public class UserContactPoints /// /// Gets or sets the mobile number /// - public string MobileNumber { get; set; } = string.Empty; + public string? MobileNumber { get; set; } /// /// Gets or sets the email address /// - public string Email { get; set; } = string.Empty; + public string? Email { get; set; } /// /// Create a new instance with the same values as the existing instance From a94354e716194304ea60d2f6f12397d0fa4247b1 Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Wed, 13 Nov 2024 17:14:22 +0100 Subject: [PATCH 2/8] Revert "Declare nullability on properties after changes in Profile API" This reverts commit d4fadb03293c676c77f9ee2d572c7c30d4ec8a9c. --- .../Models/ContactPoints/UserContactPoints.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs b/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs index 4b15c602..38b058da 100644 --- a/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs +++ b/src/Altinn.Notifications.Core/Models/ContactPoints/UserContactPoints.cs @@ -8,12 +8,12 @@ public class UserContactPoints /// /// Gets or sets the ID of the user /// - public int? UserId { get; set; } + public int UserId { get; set; } /// /// Gets or sets the national identityt number of the user /// - public string? NationalIdentityNumber { get; set; } + public string NationalIdentityNumber { get; set; } = string.Empty; /// /// Gets or sets a boolean indicating whether the user has reserved themselves from electronic communication @@ -23,12 +23,12 @@ public class UserContactPoints /// /// Gets or sets the mobile number /// - public string? MobileNumber { get; set; } + public string MobileNumber { get; set; } = string.Empty; /// /// Gets or sets the email address /// - public string? Email { get; set; } + public string Email { get; set; } = string.Empty; /// /// Create a new instance with the same values as the existing instance From 0d03814c25b120dd3ded955ba7b2a0731ecd89f8 Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Wed, 13 Nov 2024 17:15:20 +0100 Subject: [PATCH 3/8] Introduce a DTO class for UserContactPoints as received from Profile API --- .../UserContactPointsDTOMapperExtension.cs | 27 ++++++++++++++++ .../Profile/Models/UserContactPointsDTO.cs | 32 +++++++++++++++++++ .../Profile/ProfileClient.cs | 7 ++-- .../Profile/UserContactPointsList.cs | 3 +- .../Profile/ProfileClientTests.cs | 7 ++-- 5 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs create mode 100644 src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs diff --git a/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs b/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs new file mode 100644 index 00000000..ba6b770b --- /dev/null +++ b/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs @@ -0,0 +1,27 @@ +using Altinn.Notifications.Core.Models.ContactPoints; +using Altinn.Notifications.Integrations.Profile.Models; + +namespace Altinn.Notifications.Integrations.Profile.Mappers; + +/// +/// Extension class to map from DTO / Profile API model to domain model for UserContactPoints +/// +public static class UserContactPointsDTOMapperExtension +{ + /// + /// Maps the DTO model to domain model + /// + /// This DTO object + /// The UserContactPoints object mapped from this DTO object + public static UserContactPoints ToUserContactPoint(this UserContactPointsDTO userContactPointDto) + { + return new UserContactPoints + { + UserId = userContactPointDto.UserId ?? 0, + NationalIdentityNumber = userContactPointDto.NationalIdentityNumber ?? string.Empty, + IsReserved = userContactPointDto.IsReserved, + MobileNumber = userContactPointDto.MobileNumber ?? string.Empty, + Email = userContactPointDto.Email ?? string.Empty + }; + } +} diff --git a/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs b/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs new file mode 100644 index 00000000..3532063a --- /dev/null +++ b/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs @@ -0,0 +1,32 @@ +namespace Altinn.Notifications.Integrations.Profile.Models; + +/// +/// Data transfer object for the API model describing the availability of contact points for a user, received from the ProfileClient +/// +public class UserContactPointsDTO +{ + /// + /// Gets or sets the ID of the user + /// + public int? UserId { get; set; } + + /// + /// Gets or sets the national identityt number of the user + /// + public string? NationalIdentityNumber { get; set; } + + /// + /// Gets or sets a boolean indicating whether the user has reserved themselves from electronic communication + /// + public bool IsReserved { get; set; } + + /// + /// Gets or sets the mobile number + /// + public string? MobileNumber { get; set; } + + /// + /// Gets or sets the email address + /// + public string? Email { get; set; } +} diff --git a/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs b/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs index b5bcdf4b..33256266 100644 --- a/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs +++ b/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs @@ -7,6 +7,8 @@ using Altinn.Notifications.Core.Shared; using Altinn.Notifications.Integrations.Configuration; using Altinn.Notifications.Integrations.Profile; +using Altinn.Notifications.Integrations.Profile.Mappers; +using Altinn.Notifications.Integrations.Profile.Models; using Altinn.Notifications.Integrations.Register; using Microsoft.Extensions.Options; @@ -47,8 +49,9 @@ public async Task> GetUserContactPoints(List nat } string responseContent = await response.Content.ReadAsStringAsync(); - List contactPoints = JsonSerializer.Deserialize(responseContent, JsonSerializerOptionsProvider.Options)!.ContactPointsList; - return contactPoints!; + List contactPoints = JsonSerializer.Deserialize(responseContent, JsonSerializerOptionsProvider.Options)!.ContactPointsList; + + return contactPoints.Select(contactPointDto => contactPointDto.ToUserContactPoint()).ToList(); } /// diff --git a/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs b/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs index 1467d5bd..7d9eaf96 100644 --- a/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs +++ b/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs @@ -1,4 +1,5 @@ using Altinn.Notifications.Core.Models.ContactPoints; +using Altinn.Notifications.Integrations.Profile.Models; namespace Altinn.Notifications.Integrations.Profile; @@ -10,5 +11,5 @@ public class UserContactPointsList /// /// A list containing contact points for users /// - public List ContactPointsList { get; set; } = []; + public List ContactPointsList { get; set; } = []; } diff --git a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs index 3141c832..9915ae47 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs @@ -12,6 +12,7 @@ using Altinn.Notifications.Integrations.Clients; using Altinn.Notifications.Integrations.Configuration; using Altinn.Notifications.Integrations.Profile; +using Altinn.Notifications.Integrations.Profile.Models; using Altinn.Notifications.Integrations.Register; using Microsoft.Extensions.Options; @@ -128,15 +129,15 @@ private Task GetUserProfileResponse(UserContactPointLookup switch (lookup.NationalIdentityNumbers[0]) { case "empty-list": - contentData = new UserContactPointsList() { ContactPointsList = new List() }; + contentData = new UserContactPointsList() { ContactPointsList = new List() }; break; case "populated-list": contentData = new UserContactPointsList() { ContactPointsList = [ - new UserContactPoints() { NationalIdentityNumber = "01025101038", Email = string.Empty }, - new UserContactPoints() { NationalIdentityNumber = "01025101037", Email = string.Empty } + new UserContactPointsDTO() { NationalIdentityNumber = "01025101038", Email = string.Empty }, + new UserContactPointsDTO() { NationalIdentityNumber = "01025101037", Email = string.Empty } ] }; break; From bfc5a9df4638ea5172299cb34a73a4d7cdc791fc Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Thu, 14 Nov 2024 11:25:26 +0100 Subject: [PATCH 4/8] Add test for mapping of UserContactPoints DTO -> domain model --- ...serContactPointsDTOMapperExtensionTests.cs | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs diff --git a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs new file mode 100644 index 00000000..5adf85b1 --- /dev/null +++ b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs @@ -0,0 +1,64 @@ +using Altinn.Notifications.Integrations.Profile.Mappers; +using Altinn.Notifications.Integrations.Profile.Models; +using Xunit; + +namespace Altinn.Notifications.IntegrationTests.Notifications.Integrations.Profile.Mappers; + +public class UserContactPointsDTOMapperExtensionTests +{ + [Fact] + public void ToUserContactPoint_NullValues_MapsCorrectly() + { + // Arrange + var userContactPointsDTO = new UserContactPointsDTO + { + UserId = null, + NationalIdentityNumber = null, + Email = null, + IsReserved = false, + MobileNumber = null + }; + + // Act + var mappedResult = userContactPointsDTO.ToUserContactPoint(); + + // Assert + Assert.Equal(0, mappedResult.UserId); + Assert.Equal(string.Empty, mappedResult.NationalIdentityNumber); + Assert.Equal(string.Empty, mappedResult.Email); + Assert.Equal(string.Empty, mappedResult.MobileNumber); + Assert.False(mappedResult.IsReserved); + } + + [Fact] + public void ToUserContactPoint_WithValues_MapsCorrectly() + { + // Arrange + var testData = new + { + userId = 123, + nationalIdentityNumber = "12345678910", + email = "test@machinery.no", + isReserved = false, + mobileNumber = "+4712345678" + }; + var userContactPointsDTO = new UserContactPointsDTO + { + UserId = testData.userId, + NationalIdentityNumber = testData.nationalIdentityNumber, + Email = testData.email, + IsReserved = testData.isReserved, + MobileNumber = testData.mobileNumber + }; + + // Act + var mappedResult = userContactPointsDTO.ToUserContactPoint(); + + // Assert + Assert.Equal(testData.userId, mappedResult.UserId); + Assert.Equal(testData.nationalIdentityNumber, mappedResult.NationalIdentityNumber); + Assert.Equal(testData.email, mappedResult.Email); + Assert.Equal(testData.mobileNumber, mappedResult.MobileNumber); + Assert.Equal(testData.isReserved, mappedResult.IsReserved); + } +} From 3d9ee49c3d46ba63438b5470d077ac03a2f523ae Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Thu, 14 Nov 2024 11:26:10 +0100 Subject: [PATCH 5/8] Fix build warning: replace NotEmpty -> Contains --- .../EmailNotificationRepositoryTests.cs | 2 +- .../Notifications.Persistence/SmsNotificationRepositoryTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/EmailNotificationRepositoryTests.cs b/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/EmailNotificationRepositoryTests.cs index b148c8e2..849d2cf4 100644 --- a/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/EmailNotificationRepositoryTests.cs +++ b/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/EmailNotificationRepositoryTests.cs @@ -84,7 +84,7 @@ public async Task GetNewNotifications() List emailToBeSent = await repo.GetNewNotifications(); // Assert - Assert.NotEmpty(emailToBeSent.Where(s => s.NotificationId == emailNotification.Id)); + Assert.Contains(emailToBeSent, s => s.NotificationId == emailNotification.Id); } [Fact] diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/SmsNotificationRepositoryTests.cs b/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/SmsNotificationRepositoryTests.cs index e580ecda..a975c656 100644 --- a/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/SmsNotificationRepositoryTests.cs +++ b/test/Altinn.Notifications.IntegrationTests/Notifications.Persistence/SmsNotificationRepositoryTests.cs @@ -83,7 +83,7 @@ public async Task GetNewNotifications() List smsToBeSent = await repo.GetNewNotifications(); // Assert - Assert.NotEmpty(smsToBeSent.Where(s => s.NotificationId == smsNotification.Id)); + Assert.Contains(smsToBeSent, s => s.NotificationId == smsNotification.Id); } [Fact] From 283e27f8c2df2b79f888711c8877429ca8e7080a Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Thu, 14 Nov 2024 11:39:28 +0100 Subject: [PATCH 6/8] Fix warning on pascal-casing by renaming DTO class --- .../Mappers/UserContactPointsDTOMapperExtension.cs | 4 ++-- .../Profile/Models/UserContactPointsDTO.cs | 2 +- .../Profile/ProfileClient.cs | 2 +- .../Profile/UserContactPointsList.cs | 2 +- .../Mappers/UserContactPointsDTOMapperExtensionTests.cs | 8 ++++---- .../Profile/ProfileClientTests.cs | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs b/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs index ba6b770b..37b2ed80 100644 --- a/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs +++ b/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs @@ -6,14 +6,14 @@ namespace Altinn.Notifications.Integrations.Profile.Mappers; /// /// Extension class to map from DTO / Profile API model to domain model for UserContactPoints /// -public static class UserContactPointsDTOMapperExtension +public static class UserContactPointsDtoMapperExtension { /// /// Maps the DTO model to domain model /// /// This DTO object /// The UserContactPoints object mapped from this DTO object - public static UserContactPoints ToUserContactPoint(this UserContactPointsDTO userContactPointDto) + public static UserContactPoints ToUserContactPoint(this UserContactPointsDto userContactPointDto) { return new UserContactPoints { diff --git a/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs b/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs index 3532063a..75e12654 100644 --- a/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs +++ b/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs @@ -3,7 +3,7 @@ namespace Altinn.Notifications.Integrations.Profile.Models; /// /// Data transfer object for the API model describing the availability of contact points for a user, received from the ProfileClient /// -public class UserContactPointsDTO +public class UserContactPointsDto { /// /// Gets or sets the ID of the user diff --git a/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs b/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs index 33256266..85a6e275 100644 --- a/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs +++ b/src/Altinn.Notifications.Integrations/Profile/ProfileClient.cs @@ -49,7 +49,7 @@ public async Task> GetUserContactPoints(List nat } string responseContent = await response.Content.ReadAsStringAsync(); - List contactPoints = JsonSerializer.Deserialize(responseContent, JsonSerializerOptionsProvider.Options)!.ContactPointsList; + List contactPoints = JsonSerializer.Deserialize(responseContent, JsonSerializerOptionsProvider.Options)!.ContactPointsList; return contactPoints.Select(contactPointDto => contactPointDto.ToUserContactPoint()).ToList(); } diff --git a/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs b/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs index 7d9eaf96..0b8afb36 100644 --- a/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs +++ b/src/Altinn.Notifications.Integrations/Profile/UserContactPointsList.cs @@ -11,5 +11,5 @@ public class UserContactPointsList /// /// A list containing contact points for users /// - public List ContactPointsList { get; set; } = []; + public List ContactPointsList { get; set; } = []; } diff --git a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs index 5adf85b1..132d3724 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs @@ -2,15 +2,15 @@ using Altinn.Notifications.Integrations.Profile.Models; using Xunit; -namespace Altinn.Notifications.IntegrationTests.Notifications.Integrations.Profile.Mappers; +namespace Altinn.Notifications.Tests.Notifications.Integrations.Profile.Mappers; -public class UserContactPointsDTOMapperExtensionTests +public class UserContactPointsDtoMapperExtensionTests { [Fact] public void ToUserContactPoint_NullValues_MapsCorrectly() { // Arrange - var userContactPointsDTO = new UserContactPointsDTO + var userContactPointsDTO = new UserContactPointsDto { UserId = null, NationalIdentityNumber = null, @@ -42,7 +42,7 @@ public void ToUserContactPoint_WithValues_MapsCorrectly() isReserved = false, mobileNumber = "+4712345678" }; - var userContactPointsDTO = new UserContactPointsDTO + var userContactPointsDTO = new UserContactPointsDto { UserId = testData.userId, NationalIdentityNumber = testData.nationalIdentityNumber, diff --git a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs index 9915ae47..6e777a3a 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/ProfileClientTests.cs @@ -129,15 +129,15 @@ private Task GetUserProfileResponse(UserContactPointLookup switch (lookup.NationalIdentityNumbers[0]) { case "empty-list": - contentData = new UserContactPointsList() { ContactPointsList = new List() }; + contentData = new UserContactPointsList() { ContactPointsList = new List() }; break; case "populated-list": contentData = new UserContactPointsList() { ContactPointsList = [ - new UserContactPointsDTO() { NationalIdentityNumber = "01025101038", Email = string.Empty }, - new UserContactPointsDTO() { NationalIdentityNumber = "01025101037", Email = string.Empty } + new UserContactPointsDto() { NationalIdentityNumber = "01025101038", Email = string.Empty }, + new UserContactPointsDto() { NationalIdentityNumber = "01025101037", Email = string.Empty } ] }; break; From 33b14e4eb460801eae0c3fb452f22edaefcfd0db Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Thu, 14 Nov 2024 12:29:01 +0100 Subject: [PATCH 7/8] Rename files, modify comments --- .../Profile/Mappers/UserContactPointsDTOMapperExtension.cs | 2 +- .../Profile/Models/UserContactPointsDTO.cs | 2 +- .../Mappers/UserContactPointsDTOMapperExtensionTests.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs b/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs index 37b2ed80..fe1cd3cc 100644 --- a/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs +++ b/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs @@ -4,7 +4,7 @@ namespace Altinn.Notifications.Integrations.Profile.Mappers; /// -/// Extension class to map from DTO / Profile API model to domain model for UserContactPoints +/// Extension class to map user contact points from DTO to domain model /// public static class UserContactPointsDtoMapperExtension { diff --git a/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs b/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs index 75e12654..8b389c3c 100644 --- a/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs +++ b/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs @@ -1,7 +1,7 @@ namespace Altinn.Notifications.Integrations.Profile.Models; /// -/// Data transfer object for the API model describing the availability of contact points for a user, received from the ProfileClient +/// DTO for user contact points received from the ProfileClient, describing the availability of contact points for a user /// public class UserContactPointsDto { diff --git a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs index 132d3724..9c1242f9 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs @@ -14,8 +14,8 @@ public void ToUserContactPoint_NullValues_MapsCorrectly() { UserId = null, NationalIdentityNumber = null, - Email = null, IsReserved = false, + Email = null, MobileNumber = null }; @@ -25,9 +25,9 @@ public void ToUserContactPoint_NullValues_MapsCorrectly() // Assert Assert.Equal(0, mappedResult.UserId); Assert.Equal(string.Empty, mappedResult.NationalIdentityNumber); + Assert.False(mappedResult.IsReserved); Assert.Equal(string.Empty, mappedResult.Email); Assert.Equal(string.Empty, mappedResult.MobileNumber); - Assert.False(mappedResult.IsReserved); } [Fact] From 78867abc76ab178b0cc52dea637c8ef37e100872 Mon Sep 17 00:00:00 2001 From: Hallgeir Garnes-Gutvik Date: Thu, 14 Nov 2024 12:31:33 +0100 Subject: [PATCH 8/8] Change file names for real --- ...OMapperExtension.cs => UserContactPointsDtoMapperExtension.cs} | 0 .../Models/{UserContactPointsDTO.cs => UserContactPointsDto.cs} | 0 ...ensionTests.cs => UserContactPointsDtoMapperExtensionTests.cs} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/Altinn.Notifications.Integrations/Profile/Mappers/{UserContactPointsDTOMapperExtension.cs => UserContactPointsDtoMapperExtension.cs} (100%) rename src/Altinn.Notifications.Integrations/Profile/Models/{UserContactPointsDTO.cs => UserContactPointsDto.cs} (100%) rename test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/{UserContactPointsDTOMapperExtensionTests.cs => UserContactPointsDtoMapperExtensionTests.cs} (100%) diff --git a/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs b/src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDtoMapperExtension.cs similarity index 100% rename from src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs rename to src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDtoMapperExtension.cs diff --git a/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs b/src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDto.cs similarity index 100% rename from src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs rename to src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDto.cs diff --git a/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs b/test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDtoMapperExtensionTests.cs similarity index 100% rename from test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtensionTests.cs rename to test/Altinn.Notifications.Tests/Notifications.Integrations/Profile/Mappers/UserContactPointsDtoMapperExtensionTests.cs