Skip to content

Commit

Permalink
Methods name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoper02 committed Jun 23, 2024
1 parent 131234c commit 383ea09
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void CreateParticipant_ParticipantCreated_ParticipantReturned()
Status = ParticipantStatus.Interested
};

var result = participantService.CreateUpdateParticipant(participantDto);
var result = participantService.CreateOrUpdateParticipant(participantDto);

Assert.IsNotNull(result);
Assert.AreEqual("Event-Slug", result.EventSlug);
Expand All @@ -204,7 +204,7 @@ public void CreateParticipant_ParticipantDtoIsNull_NullReturned()

var participantService = new ParticipantService(mockContext.Object);

Assert.ThrowsException<ArgumentNullException>(() => participantService.CreateUpdateParticipant(null));
Assert.ThrowsException<ArgumentNullException>(() => participantService.CreateOrUpdateParticipant(null));
}

[TestMethod]
Expand Down Expand Up @@ -242,7 +242,7 @@ public void UpdateParticipant_ParticipantExists_ParticipantReturned()

var participantService = new ParticipantService(mockContext.Object);

var result = participantService.CreateUpdateParticipant(new ParticipantDto
var result = participantService.CreateOrUpdateParticipant(new ParticipantDto
{
EventSlug = "Event-Slug",
Username = "Username",
Expand All @@ -265,7 +265,7 @@ public void UpdateParticipant_ParticipantDoesNotExist_NullReturned()

var participantService = new ParticipantService(mockContext.Object);

Assert.ThrowsException<NotFoundException>(() => participantService.CreateUpdateParticipant(new ParticipantDto
Assert.ThrowsException<NotFoundException>(() => participantService.CreateOrUpdateParticipant(new ParticipantDto
{
EventSlug = "Event-Slug",
Username = "Username",
Expand All @@ -283,7 +283,7 @@ public void UpdateParticipant_ParticipantDtoIsNull_NullReturned()

var participantService = new ParticipantService(mockContext.Object);

Assert.ThrowsException<ArgumentNullException>(() => participantService.CreateUpdateParticipant(null));
Assert.ThrowsException<ArgumentNullException>(() => participantService.CreateOrUpdateParticipant(null));
}

[TestMethod]
Expand Down
6 changes: 3 additions & 3 deletions Server/ReasnAPI/ReasnAPI/Controllers/MeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public IActionResult UpdateCurrentUser(
public IActionResult GetCurrentUserImage()
{
var user = _userService.GetCurrentUser();
var image = _imageService.GetImagesByUserId(user.Id);
var image = _imageService.GetImageByUserId(user.Id);

if (image is null)
{
Expand Down Expand Up @@ -151,7 +151,7 @@ public IActionResult EnrollCurrentUserInEvent([FromRoute] string slug)
{
var user = _userService.GetCurrentUser();

var participant = _participantService.CreateUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Interested });
var participant = _participantService.CreateOrUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Interested });

var location = Url.Action(
action: nameof(GetCurrentUserEvents),
Expand All @@ -166,7 +166,7 @@ public IActionResult EnrollCurrentUserInEvent([FromRoute] string slug)
public IActionResult ConfirmCurrentUserEventAttendance([FromRoute] string slug)
{
var user = _userService.GetCurrentUser();
var participant = _participantService.CreateUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Participating });
var participant = _participantService.CreateOrUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Participating });

return Ok(participant);
}
Expand Down
2 changes: 1 addition & 1 deletion Server/ReasnAPI/ReasnAPI/Services/ImageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public ImageDto GetImageById(int id)
return imageDto;
}

public ImageDto GetImagesByUserId(int userId)
public ImageDto GetImageByUserId(int userId)
{
var image = context.Images.FirstOrDefault(image => image.ObjectId == userId && image.ObjectType == ObjectType.User);

Expand Down
2 changes: 1 addition & 1 deletion Server/ReasnAPI/ReasnAPI/Services/ParticipantService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ReasnAPI.Services;

public class ParticipantService(ReasnContext context)
{
public ParticipantDto CreateUpdateParticipant(ParticipantDto participantDto)
public ParticipantDto CreateOrUpdateParticipant(ParticipantDto participantDto)
{
ArgumentNullException.ThrowIfNull(participantDto);

Expand Down

0 comments on commit 383ea09

Please sign in to comment.