public async void Note_Update_length() { Mock <ICallPersonRepository> callPersonRepository = new Mock <ICallPersonRepository>(); callPersonRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new CallPerson())); var validator = new ApiCallPersonServerRequestModelValidator(callPersonRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCallPersonServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Note, new string('A', 8001)); }
public async void PersonId_Update_Valid_Reference() { Mock <ICallPersonRepository> callPersonRepository = new Mock <ICallPersonRepository>(); callPersonRepository.Setup(x => x.PersonByPersonId(It.IsAny <int>())).Returns(Task.FromResult <Person>(new Person())); var validator = new ApiCallPersonServerRequestModelValidator(callPersonRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCallPersonServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.PersonId, 1); }
public async void PersonTypeId_Create_Invalid_Reference() { Mock <ICallPersonRepository> callPersonRepository = new Mock <ICallPersonRepository>(); callPersonRepository.Setup(x => x.PersonTypeByPersonTypeId(It.IsAny <int>())).Returns(Task.FromResult <PersonType>(null)); var validator = new ApiCallPersonServerRequestModelValidator(callPersonRepository.Object); await validator.ValidateCreateAsync(new ApiCallPersonServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.PersonTypeId, 1); }