public async Task ChangeNotExistingTokenPayloadTest() { var dto = new ChangeTokenPayloadDto { TokenId = "sssssss", Payload = "a" }; Assert.ThrowsAsync <NotFoundException>(async() => await _tokenService.ChangePayload(dto)); }
public async Task ChangeValidPayloadTest() { var dto = new ChangeTokenPayloadDto { Payload = "new_payload", TokenId = TokenHelper.ValidToken.Id }; var result = await _tokenService.ChangePayload(dto); Assert.AreEqual(TokenHelper.ValidToken.Id, result.Id); }
public async Task <Contract.Models.Token> ChangePayload(ChangeTokenPayloadDto changeTokenPayloadDto) { ValidationHelper.ValidateAndThrow(changeTokenPayloadDto); if (!await _tokenGetOperations.ExistsById(changeTokenPayloadDto.TokenId)) { throw new NotFoundException("Токен не найден"); } return(await _tokenWriteOperations.UpdatePayload( changeTokenPayloadDto.TokenId, changeTokenPayloadDto.Payload)); }
public async Task ChangeInvalidTokenPayloadTest() { var dto = new ChangeTokenPayloadDto(); Assert.ThrowsAsync <ValidationException>(async() => await _tokenService.ChangePayload(dto)); }