Пример #1
0
        public async Task <IActionResult> Create([FromBody] CardEditModel model)
        {
            if (model.isValid())
            {
                var result = await service.CreateAsync(model);

                return(Ok(result));
            }

            return(ValidationProblem());
        }
Пример #2
0
        public void CreditCardCVVTooSmall()
        {
            var model = new CardEditModel
            {
                CardNumber = 12345678,
                CustomerId = 1,
                CVV        = 0
            };

            Assert.False(model.isValid());
        }
Пример #3
0
        public void CreditCardNumberTooSmall()
        {
            var model = new CardEditModel
            {
                CardNumber = 0,
                CustomerId = 1,
                CVV        = 654
            };

            Assert.False(model.isValid());
        }
Пример #4
0
        public void CreditCardCVVTooBig()
        {
            var model = new CardEditModel
            {
                CardNumber = 123456789,
                CustomerId = 1,
                CVV        = 654321
            };

            Assert.False(model.isValid());
        }
Пример #5
0
        public void ValidCreditCard()
        {
            var model = new CardEditModel
            {
                CardNumber = 123456,
                CustomerId = 1,
                CVV        = 654
            };

            Assert.True(model.isValid());
        }