private async void BeUniqueByAccountNumber_Update_Not_Exists() { Mock <ICustomerRepository> customerRepository = new Mock <ICustomerRepository>(); customerRepository.Setup(x => x.ByAccountNumber(It.IsAny <string>())).Returns(Task.FromResult <Customer>(null)); var validator = new ApiCustomerRequestModelValidator(customerRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCustomerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.AccountNumber, "A"); }
public async void StoreID_Create_Valid_Reference() { Mock <ICustomerRepository> customerRepository = new Mock <ICustomerRepository>(); customerRepository.Setup(x => x.StoreByStoreID(It.IsAny <int>())).Returns(Task.FromResult <Store>(new Store())); var validator = new ApiCustomerRequestModelValidator(customerRepository.Object); await validator.ValidateCreateAsync(new ApiCustomerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.StoreID, 1); }
public async void TerritoryID_Update_Valid_Reference() { Mock <ICustomerRepository> customerRepository = new Mock <ICustomerRepository>(); customerRepository.Setup(x => x.SalesTerritoryByTerritoryID(It.IsAny <int>())).Returns(Task.FromResult <SalesTerritory>(new SalesTerritory())); var validator = new ApiCustomerRequestModelValidator(customerRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiCustomerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.TerritoryID, 1); }