public async Task <IActionResult> RemoveFollower(int followerId) { await _cityParticipantsService.RemoveFollowerAsync(followerId); _logger.LogInformation($"Follower with ID {{{followerId}}} was removed."); return(Ok()); }
public async Task RemoveFollowerAsync_Valid_Test(string email, string cityName) { // Arrange _repoWrapper .Setup(x => x.CityMembers .GetFirstOrDefaultAsync(It.IsAny <Expression <Func <CityMembers, bool> > >(), It.IsAny <Func <IQueryable <CityMembers>, IIncludableQueryable <CityMembers, object> > >())) .ReturnsAsync(new CityMembers { UserId = fakeId.ToString(), User = new User { Email = email }, City = new DataAccess.Entities.City { Name = cityName }, IsApproved = false }); _repoWrapper .Setup(x => x.CityMembers.Delete(It.IsAny <CityMembers>())); _repoWrapper .Setup(x => x.SaveAsync()); _emailSendingService .Setup(x => x.SendEmailAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(true); _emailContentService .Setup(x => x.GetCityRemoveFollowerEmail(It.IsAny <string>(), It.IsAny <string>())) .Returns(new EmailModel()); // Act await _cityParticipantsService.RemoveFollowerAsync(fakeId); // Assert _repoWrapper.Verify(); }