public async void Category_Update_length() { Mock <ISpecialOfferRepository> specialOfferRepository = new Mock <ISpecialOfferRepository>(); specialOfferRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new SpecialOffer())); var validator = new ApiSpecialOfferRequestModelValidator(specialOfferRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiSpecialOfferRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Category, new string('A', 51)); }
public async void Description_Update_null() { Mock <ISpecialOfferRepository> specialOfferRepository = new Mock <ISpecialOfferRepository>(); specialOfferRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new SpecialOffer())); var validator = new ApiSpecialOfferRequestModelValidator(specialOfferRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiSpecialOfferRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Description, null as string); }
public async void Description_Create_length() { Mock <ISpecialOfferRepository> specialOfferRepository = new Mock <ISpecialOfferRepository>(); specialOfferRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new SpecialOffer())); var validator = new ApiSpecialOfferRequestModelValidator(specialOfferRepository.Object); await validator.ValidateCreateAsync(new ApiSpecialOfferRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Description, new string('A', 256)); }