public async void Description_Update_length() { Mock <IProductDescriptionRepository> productDescriptionRepository = new Mock <IProductDescriptionRepository>(); productDescriptionRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new ProductDescription())); var validator = new ApiProductDescriptionRequestModelValidator(productDescriptionRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiProductDescriptionRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Description, new string('A', 401)); }
public async void Description_Create_null() { Mock <IProductDescriptionRepository> productDescriptionRepository = new Mock <IProductDescriptionRepository>(); productDescriptionRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new ProductDescription())); var validator = new ApiProductDescriptionRequestModelValidator(productDescriptionRepository.Object); await validator.ValidateCreateAsync(new ApiProductDescriptionRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Description, null as string); }