public async void AccountNumber_Update_length() { Mock <IBankAccountRepository> bankAccountRepository = new Mock <IBankAccountRepository>(); bankAccountRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new BankAccount())); var validator = new ApiBankAccountServerRequestModelValidator(bankAccountRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiBankAccountServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.AccountNumber, new string('A', 25)); }
public async void ArtistId_Create_Valid_Reference() { Mock <IBankAccountRepository> bankAccountRepository = new Mock <IBankAccountRepository>(); bankAccountRepository.Setup(x => x.ArtistByArtistId(It.IsAny <int>())).Returns(Task.FromResult <Artist>(new Artist())); var validator = new ApiBankAccountServerRequestModelValidator(bankAccountRepository.Object); await validator.ValidateCreateAsync(new ApiBankAccountServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ArtistId, 1); }
public async void RoutingNumber_Create_null() { Mock <IBankAccountRepository> bankAccountRepository = new Mock <IBankAccountRepository>(); bankAccountRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new BankAccount())); var validator = new ApiBankAccountServerRequestModelValidator(bankAccountRepository.Object); await validator.ValidateCreateAsync(new ApiBankAccountServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.RoutingNumber, null as string); }