Exemple #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));
        }
Exemple #2
0
        public async void ArtistId_Update_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.ValidateUpdateAsync(default(int), new ApiBankAccountServerRequestModel());

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