public async void SalesPersonID_Create_Valid_Reference() { Mock <IStoreRepository> storeRepository = new Mock <IStoreRepository>(); storeRepository.Setup(x => x.SalesPersonBySalesPersonID(It.IsAny <int>())).Returns(Task.FromResult <SalesPerson>(new SalesPerson())); var validator = new ApiStoreRequestModelValidator(storeRepository.Object); await validator.ValidateCreateAsync(new ApiStoreRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.SalesPersonID, 1); }
public async void Name_Create_length() { Mock <IStoreRepository> storeRepository = new Mock <IStoreRepository>(); storeRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Store())); var validator = new ApiStoreRequestModelValidator(storeRepository.Object); await validator.ValidateCreateAsync(new ApiStoreRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 51)); }