private async void BeUniqueByName_Update_Not_Exists() { Mock <IUserRoleRepository> userRoleRepository = new Mock <IUserRoleRepository>(); userRoleRepository.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <UserRole>(null)); var validator = new ApiUserRoleRequestModelValidator(userRoleRepository.Object); await validator.ValidateUpdateAsync(default(string), new ApiUserRoleRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.Name, "A"); }
public async void Name_Update_length() { Mock <IUserRoleRepository> userRoleRepository = new Mock <IUserRoleRepository>(); userRoleRepository.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(new UserRole())); var validator = new ApiUserRoleRequestModelValidator(userRoleRepository.Object); await validator.ValidateUpdateAsync(default(string), new ApiUserRoleRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 201)); }