Skip to content

Commit

Permalink
Remove 3 unnecessary interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
SandGrainOne committed Oct 24, 2024
1 parent 23151bb commit f8fa0e4
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 134 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Altinn.Profile.Core.Person.ContactPreferences;
/// <summary>
/// Represents a snapshot of the contact details retrieved from the changes log.
/// </summary>
public record PersonContactDetailsSnapshot : IPersonContactDetailsSnapshot
public record PersonContactDetailsSnapshot
{
/// <summary>
/// Gets the email address of the person.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Altinn.Profile.Core.Person.ContactPreferences;
/// <summary>
/// Represents a person's contact details.
/// </summary>
public record PersonContactPreferences : IPersonContactPreferences
public record PersonContactPreferences
{
/// <summary>
/// Gets the email address of the person.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Altinn.Profile.Core.Person.ContactPreferences;
/// <summary>
/// Represents a log of changes to a person's contact preferences, including contact information, language preference, notification status, and other details.
/// </summary>
public class PersonContactPreferencesSnapshot : IPersonContactPreferencesSnapshot
public class PersonContactPreferencesSnapshot
{
/// <summary>
/// Gets the contact information details of the person.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ public static void AddMaskinportenClient(this IServiceCollection services, IConf
}

services.AddScoped<IContactRegisterService, ContactRegisterService>();
services.AddScoped<IPersonContactPreferencesSnapshot, PersonContactPreferencesSnapshot>();
services.AddScoped<IPersonContactDetailsSnapshot, PersonContactDetailsSnapshot>();

services.AddSingleton(contactRegisterSettings);
services.AddMaskinportenHttpClient<SettingsJwkClientDefinition, IContactRegisterHttpClient, ContactRegisterHttpClient>(contactRegisterSettings.MaskinportenSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task<Result<PersonContactDetailsLookupResult, bool>> RetrieveAsync(
/// <param name="contactPreferences">The person contact details to map.</param>
/// <returns>The mapped <see cref="PersonContactDetails"/>.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="contactPreferences"/> is null.</exception>
private PersonContactDetails MapToContactDetails(IPersonContactPreferences contactPreferences)
private PersonContactDetails MapToContactDetails(PersonContactPreferences contactPreferences)
{
ArgumentNullException.ThrowIfNull(contactPreferences);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public async Task GetContactDetailsAsync_WhenAllNumbersValidAndAllContactsFound_

// Assert
IEnumerable<string>? unmatchedNationalIdentityNumbers = null;
IEnumerable<IPersonContactPreferences>? matchedPersonContactDetails = null;
IEnumerable<PersonContactPreferences>? matchedPersonContactDetails = null;

result.Match(
success =>
Expand Down Expand Up @@ -141,7 +141,7 @@ public async Task GetContactDetailsAsync_WhenMultipleNationalIdentityNumbersAreP

_mapperMock.Setup(x => x.Map<PersonContactPreferences>(firstRandomPerson))
.Returns(firstMappedContactDetails);
_mapperMock.Setup(x => x.Map<IPersonContactPreferences>(secondRandomPerson))
_mapperMock.Setup(x => x.Map<PersonContactPreferences>(secondRandomPerson))
.Returns(secondMappedContactDetails);

_personRepositoryMock
Expand All @@ -157,7 +157,7 @@ public async Task GetContactDetailsAsync_WhenMultipleNationalIdentityNumbersAreP

// Assert
IEnumerable<string>? unmatchedNationalIdentityNumbers = null;
IEnumerable<IPersonContactPreferences>? matchedPersonContactDetails = null;
IEnumerable<PersonContactPreferences>? matchedPersonContactDetails = null;

result.Match(
success =>
Expand Down Expand Up @@ -203,7 +203,7 @@ public async Task GetContactDetailsAsync_WhenNationalIdentityNumberIsInvalid_Ret

// Assert
IEnumerable<string>? unmatchedNationalIdentityNumbers = null;
IEnumerable<IPersonContactPreferences>? matchedPersonContactDetails = null;
IEnumerable<PersonContactPreferences>? matchedPersonContactDetails = null;
result.Match(
success =>
{
Expand Down Expand Up @@ -256,7 +256,7 @@ public async Task GetContactDetailsAsync_WhenNationalIdentityNumberIsValid_Retur

// Assert
IEnumerable<string>? unmatchedNationalIdentityNumbers = null;
IEnumerable<IPersonContactPreferences>? matchedPersonContactDetails = null;
IEnumerable<PersonContactPreferences>? matchedPersonContactDetails = null;

result.Match(
success =>
Expand All @@ -283,7 +283,7 @@ public async Task GetContactDetailsAsync_WhenNationalIdentityNumberIsValid_Retur
/// </summary>
/// <param name="expected">The expected contact preferences.</param>
/// <param name="actualContactDetails">The actual contact details.</param>
private static void AssertContactDetails(PersonContactPreferences expected, IEnumerable<IPersonContactPreferences> actualContactDetails)
private static void AssertContactDetails(PersonContactPreferences expected, IEnumerable<PersonContactPreferences> actualContactDetails)
{
var contactDetails = actualContactDetails.FirstOrDefault(detail => detail.NationalIdentityNumber == expected.NationalIdentityNumber);

Expand Down

0 comments on commit f8fa0e4

Please sign in to comment.