Exemplo n.º 1
0
        public void FilterDigit_ThrowsArgumentNullException()
        {
            List <int> emptyList = new List <int>();
            int        digit     = 2;

            Assert.Throws <ArgumentNullException>(() => IntListOperations.FilterDigit(emptyList, digit));
        }
Exemplo n.º 2
0
        public void FilterDigit_ThrowsArgumentOutOfRangeException(int digit)
        {
            List <int> testList = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 68, 69, 70, 15, 17, 28, 307
            };

            Assert.Throws <ArgumentOutOfRangeException>(() => IntListOperations.FilterDigit(testList, digit));
        }
Exemplo n.º 3
0
        public void FilterDigit_NegativeResultTest()
        {
            List <int> testList = new List <int> {
                1, 2, 3, 4, 5, 6, 7
            };
            List <int> expected = new List <int>();
            int        digit    = 8;
            List <int> actual   = IntListOperations.FilterDigit(testList, digit);

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 4
0
        public void FilterDigit_PositiveResultTest()
        {
            List <int> testList = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 68, 69, 70, 15, 17, 28, 307
            };
            List <int> expected = new List <int> {
                7, 70, 17, 307
            };
            int        digit  = 7;
            List <int> actual = IntListOperations.FilterDigit(testList, digit);

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 5
0
 public void IsNumberContainsDigit_Tests(int listItem, int digit, bool expected)
 {
     Assert.AreEqual(expected, IntListOperations.IsNumberContainsDigit(listItem, digit));
 }