Exemple #1
0
        public void TestValidVisaCard()
        {
            // Arrange
            CardValidatorController  controller     = new CardValidatorController();
            CardValidationParameters cardParameters = new CardValidationParameters
            {
                Number     = 4234567890123456,
                ExpiryDate = new DateTime(2020, 10, 26)
            };

            // Act
            IEnumerable <string> result = controller.Get(cardParameters);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count());
            Assert.AreEqual("Valid", result.ElementAt(0));
            Assert.AreEqual("Visa", result.ElementAt(1));
        }
Exemple #2
0
        public void TestNonsenseCard()
        {
            // Arrange
            CardValidatorController  controller     = new CardValidatorController();
            CardValidationParameters cardParameters = new CardValidationParameters
            {
                Number     = 0,
                ExpiryDate = DateTime.Now
            };

            // Act
            IEnumerable <string> result = controller.Get(cardParameters);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count());
            Assert.AreEqual("Does not exists", result.ElementAt(0));
            Assert.AreEqual("Unknown", result.ElementAt(1));
        }