public async void UserId_Update_length() { Mock <IApiKeyRepository> apiKeyRepository = new Mock <IApiKeyRepository>(); apiKeyRepository.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(new ApiKey())); var validator = new ApiApiKeyRequestModelValidator(apiKeyRepository.Object); await validator.ValidateUpdateAsync(default(string), new ApiApiKeyRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.UserId, new string('A', 51)); }
private async void BeUniqueByApiKeyHashed_Update_Not_Exists() { Mock <IApiKeyRepository> apiKeyRepository = new Mock <IApiKeyRepository>(); apiKeyRepository.Setup(x => x.ByApiKeyHashed(It.IsAny <string>())).Returns(Task.FromResult <ApiKey>(null)); var validator = new ApiApiKeyRequestModelValidator(apiKeyRepository.Object); await validator.ValidateUpdateAsync(default(string), new ApiApiKeyRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ApiKeyHashed, "A"); }