-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7917ba4
commit 6640110
Showing
2 changed files
with
13 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] | ||
|
@@ -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 | ||
|
@@ -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); | ||
|
@@ -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 | ||
|
@@ -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 | ||
|