コード例 #1
0
        public void FilterDigitEmptyListTest()
        {
            NumericFun numericFun = new NumericFun();

            Assert.Throws <ArgumentException>(() => numericFun.FilterDigit(new List <int>()
            {
            }, 0), "List can't be empty");
        }
コード例 #2
0
        public void FilterDigitEmptyNotDigitInFilterTest2()
        {
            NumericFun numericFun = new NumericFun();

            Assert.Throws <ArgumentException>(() => numericFun.FilterDigit(new List <int>()
            {
                -17, -1, 22
            }, -1), "Filter can be only natural digit");
        }
コード例 #3
0
        public void FilterDigitSimpleTest4()
        {
            NumericFun numericFun = new NumericFun();
            List <int> expected   = new List <int>()
            {
            };

            Assert.AreEqual(expected, numericFun.FilterDigit(new List <int>()
            {
                0, 256, 128, -99, 888, -777777, 7777777
            }, 4));
        }
コード例 #4
0
        public void FilterDigitSimpleTest3()
        {
            NumericFun numericFun = new NumericFun();
            List <int> expected   = new List <int>()
            {
                int.MinValue, int.MaxValue, -777777, 7777777
            };

            Assert.AreEqual(expected, numericFun.FilterDigit(new List <int>()
            {
                0, int.MinValue, int.MaxValue, 346645623, 1235523940, -777777, 7777777
            }, 7));
        }
コード例 #5
0
        public void FilterDigitSimpleTest2()
        {
            NumericFun numericFun = new NumericFun();
            List <int> expected   = new List <int>()
            {
                0, 0, 0, 10, 0, 100
            };

            Assert.AreEqual(expected, numericFun.FilterDigit(new List <int>()
            {
                0, 0, 0, 10, 0, 100, -1
            }, 0));
        }
コード例 #6
0
        public void FilterDigitSimpleTest1()
        {
            NumericFun numericFun = new NumericFun();
            List <int> expected   = new List <int>()
            {
                1, -11, 151, 13
            };

            Assert.AreEqual(expected, numericFun.FilterDigit(new List <int>()
            {
                1, 2, 3, 4, -11, 151, 13
            }, 1));
        }
コード例 #7
0
        public void FilterDigitNullListTest()
        {
            NumericFun numericFun = new NumericFun();

            Assert.Throws <ArgumentNullException>(() => numericFun.FilterDigit(null, 0), "List can't be null");
        }