Skip to content

Commit

Permalink
Fix build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticFragilist committed Mar 25, 2024
1 parent 7917ba4 commit 6640110
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion core/Controllers/ModeratorUserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ await emailService.SendEmailAsync(
"Votre compte Hello!",
new UserCreationModel
{
Salutation = $"Bonjour {organizer.Organisation},",
Title = "Création de votre compte Hello",
Salutation = $"Bonjour {organizer.Organization},",
AccountCreatedText = "Votre compte Hello a été créé!",
TemporaryPasswordHeader = "Votre mot de passe temporaire est: ",
TemporaryPassword = strongPassword,
Expand Down Expand Up @@ -62,6 +63,7 @@ await emailService.SendEmailAsync(
"Votre compte Hello a été désactivé",
new UserDeactivationModel
{
Title = "Désactivation de votre compte Hello",
Salutation = $"Bonjour {organizer.Organization},",
UserDeactivationHeader = "Votre compte Hello a été désactivé pour la raison suivate: ",
UserDeactivationReason = reason ?? "",
Expand Down
17 changes: 10 additions & 7 deletions tests/Tests/Services/UserServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@
using api.core.repositories.abstractions;
using api.core.Services;
using api.core.Data.Responses;
using api.files.Services.Abstractions;

namespace api.tests.Tests.Services;
public class UserServiceTests
{
private readonly Mock<IOrganizerRepository> _organizerRepositoryMock;
private readonly Mock<IModeratorRepository> _moderatorRepositoryMock;
private readonly Mock<IFileShareService> _fileShareServiceMock;
private readonly UserService _userService;

public UserServiceTests()
{
_organizerRepositoryMock = new Mock<IOrganizerRepository>();
_moderatorRepositoryMock = new Mock<IModeratorRepository>();
_userService = new UserService(_organizerRepositoryMock.Object, _moderatorRepositoryMock.Object);
_fileShareServiceMock = new Mock<IFileShareService>();
_userService = new UserService(_organizerRepositoryMock.Object, _fileShareServiceMock.Object, _moderatorRepositoryMock.Object);
}

[Fact]
Expand All @@ -29,14 +32,14 @@ public void AddOrganizer_ShouldReturnUserResponseDTO_WhenOrganizerIsAddedSuccess
var organizerDto = new UserUpdateDTO
{
Email = "[email protected]",
Organisation = "ExampleOrg",
Organization = "ExampleOrg",
ActivityArea = "Tech"
};

var organizer = new Organizer
{
Email = organizerDto.Email,
Organisation = organizerDto.Organisation,
Organization = organizerDto.Organization,
ActivityArea = organizerDto.ActivityArea,
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow
Expand All @@ -50,7 +53,7 @@ public void AddOrganizer_ShouldReturnUserResponseDTO_WhenOrganizerIsAddedSuccess
// Assert
result.Should().NotBeNull();
result.Email.Should().Be(organizerDto.Email);
result.Organization.Should().Be(organizerDto.Organisation);
result.Organization.Should().Be(organizerDto.Organization);
result.ActivityArea.Should().Be(organizerDto.ActivityArea);

_organizerRepositoryMock.Verify(repo => repo.Add(It.IsAny<Organizer>()), Times.Once);
Expand All @@ -65,7 +68,7 @@ public void GetUser_ShouldReturnUserResponseDTO_WhenOrganizerIsFoundById()
{
Id = organizerId,
Email = "[email protected]",
Organisation = "ExampleOrg",
Organization = "ExampleOrg",
ActivityArea = "Tech",
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow
Expand Down Expand Up @@ -140,15 +143,15 @@ public void UpdateUser_ShouldReturnTrue_WhenOrganizerIsUpdatedSuccessfully()
var updateDto = new UserUpdateDTO
{
Email = "[email protected]",
Organisation = "NewOrg",
Organization = "NewOrg",
ActivityArea = "Health"
};

var existingOrganizer = new Organizer
{
Id = organizerId,
Email = "[email protected]",
Organisation = "ExampleOrg",
Organization = "ExampleOrg",
ActivityArea = "Tech",
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow
Expand Down

0 comments on commit 6640110

Please sign in to comment.