Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public async void ArtistId_Create_Invalid_Reference()
        {
            Mock <IBankAccountRepository> bankAccountRepository = new Mock <IBankAccountRepository>();

            bankAccountRepository.Setup(x => x.ArtistByArtistId(It.IsAny <int>())).Returns(Task.FromResult <Artist>(null));

            var validator = new ApiBankAccountServerRequestModelValidator(bankAccountRepository.Object);

            await validator.ValidateCreateAsync(new ApiBankAccountServerRequestModel());

            validator.ShouldHaveValidationErrorFor(x => x.ArtistId, 1);
        }