public async void ReasonType_Update_null() { Mock <ISalesReasonRepository> salesReasonRepository = new Mock <ISalesReasonRepository>(); salesReasonRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new SalesReason())); var validator = new ApiSalesReasonRequestModelValidator(salesReasonRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiSalesReasonRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.ReasonType, null as string); }
public async void Name_Create_length() { Mock <ISalesReasonRepository> salesReasonRepository = new Mock <ISalesReasonRepository>(); salesReasonRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new SalesReason())); var validator = new ApiSalesReasonRequestModelValidator(salesReasonRepository.Object); await validator.ValidateCreateAsync(new ApiSalesReasonRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 51)); }