Exemplo n.º 1
0
        public void NullAccountFailsValidation()
        {
            ChapsPaymentValidator sut = GetSystemUnderTest();

            bool result = sut.ValidatePayment(null, It.IsAny <decimal>());

            Assert.False(result);
        }
        public void ChapsPaymentValidator_AllowedPaymentSchemes_ReturnsValid()
        {
            var bacs = new ChapsPaymentValidator();

            var account = new Account {
                AllowedPaymentSchemes = AllowedPaymentSchemes.Chaps, Status = AccountStatus.Live
            };

            Assert.True(bacs.IsValid(account, 0));
        }
        public void ChapsPaymentValidator_InValidAccount_ReturnsInValid()
        {
            var chaps = new ChapsPaymentValidator();

            var account = new Account {
                AllowedPaymentSchemes = AllowedPaymentSchemes.Bacs, Status = AccountStatus.InboundPaymentsOnly
            };

            Assert.False(chaps.IsValid(account, 0));
        }
        public void CheckPaymentValid_False_IfAccountNull()
        {
            var chapsPaymentValidator = new ChapsPaymentValidator();

            var     request = new MakePaymentRequest();
            Account account = null;

            var validationResult = chapsPaymentValidator.CheckPaymentValid(request, account);

            Assert.That(validationResult, Is.False);
        }
Exemplo n.º 5
0
        public void DoesNotAllowChapsFailsValidation(AllowedPaymentSchemes schemes)
        {
            ChapsPaymentValidator sut = GetSystemUnderTest();
            Account account           = _fixture.Create <Account>();

            account.AllowedPaymentSchemes = schemes;

            bool result = sut.ValidatePayment(account, It.IsAny <decimal>());

            Assert.False(result);
        }
Exemplo n.º 6
0
        public void AllowsChapsPassessValidation(AllowedPaymentSchemes schemes)
        {
            ChapsPaymentValidator sut = GetSystemUnderTest();
            Account account           = _fixture.Create <Account>();

            account.Status = AccountStatus.Live;
            account.AllowedPaymentSchemes = schemes;

            bool result = sut.ValidatePayment(account, It.IsAny <decimal>());

            Assert.True(result);
        }
Exemplo n.º 7
0
        public void NonLiveStatusFailsValidation(AccountStatus status)
        {
            ChapsPaymentValidator sut = GetSystemUnderTest();
            Account account           = _fixture.Create <Account>();

            account.Status = status;
            account.AllowedPaymentSchemes = AllowedPaymentSchemes.Chaps;

            bool result = sut.ValidatePayment(account, It.IsAny <decimal>());

            Assert.False(result);
        }
        public void CheckPaymentValid_False_IfAllowedSchemesBacs()
        {
            var chapsPaymentValidator = new ChapsPaymentValidator();

            var     request = new MakePaymentRequest();
            Account account = new Account {
                AllowedPaymentSchemes = AllowedPaymentSchemes.Bacs
            };

            var validationResult = chapsPaymentValidator.CheckPaymentValid(request, account);

            Assert.That(validationResult, Is.False);
        }
        public void CheckPaymentValid_True_IfAllowedSchemesChapsAndAccountStatusIsLive()
        {
            var chapsPaymentValidator = new ChapsPaymentValidator();

            var     request = new MakePaymentRequest();
            Account account = new Account
            {
                AllowedPaymentSchemes = AllowedPaymentSchemes.Chaps,
                Status = AccountStatus.Live
            };

            var validationResult = chapsPaymentValidator.CheckPaymentValid(request, account);

            Assert.That(validationResult, Is.True);
        }
        public void CheckPaymentValid_False_AndAccountStatusIsInboundPaymentsOnly()
        {
            var chapsPaymentValidator = new ChapsPaymentValidator();

            var     request = new MakePaymentRequest();
            Account account = new Account
            {
                AllowedPaymentSchemes = AllowedPaymentSchemes.Chaps,
                Status = AccountStatus.InboundPaymentsOnly
            };

            var validationResult = chapsPaymentValidator.CheckPaymentValid(request, account);

            Assert.That(validationResult, Is.False);
        }
Exemplo n.º 11
0
 public void SetUp()
 {
     chapsPaymentValidator = new ChapsPaymentValidator();
 }