public async Task AddKudosLog_UserIsAdminAndTotalPointsIsNotNull_AddKudosLogWithExplicitAmountIsInvoked() { // Arrange const int explicitAmount = 123456; var request = new AddKudosLogViewModel { TotalPointsPerReceiver = explicitAmount }; var mappedRequest = new AddKudosLogDTO(); _mapper.Map <AddKudosLogViewModel, AddKudosLogDTO>(request).Returns(mappedRequest); _permissionService.UserHasPermission(Arg.Any <UserAndOrganizationDTO>(), AdministrationPermissions.Kudos) .Returns(true); // Act var result = await _kudosController.AddKudosLog(request).ExecuteAsync(CancellationToken.None); // Assert Assert.AreEqual(HttpStatusCode.OK, result.StatusCode); _kudosService.Received(1).AddKudosLog(mappedRequest, explicitAmount); }
public void Should_Recalculate_Donators_Kudos() { var donationDto = new KudosBasketDonationDTO { DonationAmount = 20, OrganizationId = 2, UserId = "testUserId", Id = 10 }; _kudosBasketService.MakeDonation(donationDto); var user = _usersDbSet.First(u => u.Id == "testUserId"); _kudosService.Received(1).UpdateProfileKudos(user, donationDto); }
public async Task Should_Recalculate_Donators_Kudos() { var donationDto = new KudosBasketDonationDto { DonationAmount = 20, OrganizationId = 2, UserId = "testUserId", Id = 10 }; await _kudosBasketService.MakeDonationAsync(donationDto); var user = await _usersDbSet.FirstAsync(u => u.Id == "testUserId"); await _kudosService.Received(1).UpdateProfileKudosAsync(user, donationDto); }