예제 #1
0
        public void GetNullListReturnArgumentNullException()
        {
            FilterDigitClass class1    = new FilterDigitClass();
            List <int>       inputList = null;
            int digit = 3;

            Assert.ThrowsException <ArgumentNullException>(() => class1.FilterDigit(inputList, digit));
        }
예제 #2
0
        public void GetDigitMoreThen9ReturnArgumentException()
        {
            FilterDigitClass class1    = new FilterDigitClass();
            List <int>       inputList = new List <int> {
                13, 4, 2, 6, 7, 24, 67
            };
            int digit = 12;

            Assert.ThrowsException <ArgumentException>(() => class1.FilterDigit(inputList, digit));
        }
예제 #3
0
        public void FilterDigitTestCaseBigSizeArray()
        {
            int[] array = Enumerable.Range(int.MinValue / 100, int.MaxValue / 100).ToArray();

            int [] actual = FilterDigitClass.FilterDigit(new DigitPredicate(2), array);

            int[] expected = array.Where(x => new DigitPredicate(2).IsMatch(x)).ToArray();

            CollectionAssert.AreEqual(actual, expected);
        }
예제 #4
0
        public void PositiveTest()
        {
            // Arrange
            FilterDigitClass class1    = new FilterDigitClass();
            List <int>       inputList = new List <int> {
                13, 4, -4, -2, 6, -7, 24, 67, 45, 278, 0, -3
            };
            int        digit    = 4;
            List <int> expected = new List <int> {
                4, -4, 24, 45
            };
            // Act
            List <int> actual = class1.FilterDigit(inputList, digit);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
        public static void Main(string[] args)
        {
            InsertionAndFindNextBiggerNum f = new InsertionAndFindNextBiggerNum();

            f.Insertion_test_arg_out_of_range_exc_test(3, 1, 6, 5);
            FindNextBiggerNumTest ff = new FindNextBiggerNumTest();

            Console.WriteLine(ff.FindNextBiggerNumberNUnitTest1(25));
            int[] an_arr = { 0, 1, 333, 133, 12, 5, 7, 5, 12 };
            Digit digit  = new Digit(1);

            int [] filtered = FilterDigitClass.FilterDigit(an_arr, digit);
            foreach (int i in filtered)
            {
                Console.WriteLine(i + " ");
            }

            Console.ReadKey();
        }
예제 #6
0
파일: Tests.cs 프로젝트: Yananisan/Epam
 public void CheckOnEmpty() => Assert.Throws <ArgumentException>(() =>
                                                                 FilterDigitClass.FilterDigit(-1, new int[] { }));
예제 #7
0
파일: Tests.cs 프로젝트: Yananisan/Epam
 public void CheckOnNull() => Assert.Throws <ArgumentNullException>(() =>
                                                                    FilterDigitClass.FilterDigit(-1, null));
예제 #8
0
파일: Tests.cs 프로젝트: Yananisan/Epam
 public int[] FilterDigitTests(int number, int[] array) =>
 FilterDigitClass.FilterDigit(number, array);
예제 #9
0
 public int[] FilterDigitTestCase2(int[] array)
 {
     array = FilterDigitClass.FilterDigit(new DigitPredicate(0), array);
     return(array);
 }