public async void Shelf_Update_length() { Mock <IProductInventoryRepository> productInventoryRepository = new Mock <IProductInventoryRepository>(); productInventoryRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new ProductInventory())); var validator = new ApiProductInventoryRequestModelValidator(productInventoryRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiProductInventoryRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Shelf, new string('A', 11)); }
public async void Shelf_Create_null() { Mock <IProductInventoryRepository> productInventoryRepository = new Mock <IProductInventoryRepository>(); productInventoryRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new ProductInventory())); var validator = new ApiProductInventoryRequestModelValidator(productInventoryRepository.Object); await validator.ValidateCreateAsync(new ApiProductInventoryRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Shelf, null as string); }