public async void Notes_Update_null() { Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>(); customerCommunicationRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new CustomerCommunication())); var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCustomerCommunicationServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Notes, null as string); }
public async void EmployeeId_Create_Invalid_Reference() { Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>(); customerCommunicationRepository.Setup(x => x.EmployeeByEmployeeId(It.IsAny <int>())).Returns(Task.FromResult <Employee>(null)); var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object); await validator.ValidateCreateAsync(new ApiCustomerCommunicationServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.EmployeeId, 1); }
public async void CustomerId_Update_Invalid_Reference() { Mock <ICustomerCommunicationRepository> customerCommunicationRepository = new Mock <ICustomerCommunicationRepository>(); customerCommunicationRepository.Setup(x => x.CustomerByCustomerId(It.IsAny <int>())).Returns(Task.FromResult <Customer>(null)); var validator = new ApiCustomerCommunicationServerRequestModelValidator(customerCommunicationRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCustomerCommunicationServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.CustomerId, 1); }