public void FilterDigit_7()
        {
            var collection = new int[] { 7, 1, 2, 3, 4, 5, 6, 7, 68, 69, 70, 15, 17 };
            var expected   = new int[] { 7, 70, 17 };

            var actual = Task4.FilterDigit(collection, 7).ToArray();

            CollectionAssert.AreEqual(expected, actual);
        }
        public void FilterDigit_8()
        {
            var collection = new int[] { 8, 81, 67582, 53, 81, 2324, 8, 3335, 81, 86 };
            var expected   = new int[] { 8, 81, 67582, 86 };

            var actual = Task4.FilterDigit(collection, 8).ToArray();

            CollectionAssert.AreEqual(expected, actual);
        }
Beispiel #3
0
        public void FilterDigit_InputCorrectValues()
        {
            //Arrange
            int currentDigit = 5;
            List<int> inputList = new List<int> { 1, 2, 5, 7, 3, 334, 566, 223, 66, 334, 54, 95, 8 };
            List<int> expected = new List<int> { 5, 566, 54, 95 };

            //Act
            List<int> result = Task4.FilterDigit(inputList, currentDigit);

            //Assert
            Assert.IsTrue(expected.SequenceEqual(result));
        }
        public void FilterDigitTest_InputListOfNumber1_3_7_55_4_15_56_253_33WithDigit8_ExpectedEmpty()
        {
            Task4      task4 = new Task4();
            List <int> list  = new List <int> {
                1, 3, 7, 55, 4, 15, 56, 253, 33
            };
            int        digit    = 8;
            List <int> expected = new List <int>();
            List <int> actual   = task4.FilterDigit(list, digit);

            // Assert.AreEqual(actual.Count,expected.Count);
            Assert.IsTrue(actual.SequenceEqual(expected));
        }
Beispiel #5
0
        public void FilterDigistTestOne()
        {
            Task4      item    = new Task4();
            List <int> numbers = new List <int>()
            {
                14, 51, 72, 4, 88, 11, 41, 7, 1482
            };
            List <int> expectedResult = new List <int>()
            {
                14, 4, 41, 1482
            };
            int        numberByCompare = 4;
            List <int> result          = item.FilterDigit(numbers, numberByCompare);

            expectedResult.Any(element => expectedResult.Contains(element));
        }
Beispiel #6
0
        public void FilterDigitTest2()
        {
            //arrange
            List <int> testList = new List <int>()
            {
                33, 71, 19, 32, 4, 9, 13, 8, 6, 7, 11, 91, 0
            };
            int        testNumber = 1;
            List <int> expected   = new List <int>()
            {
                71, 19, 13, 11, 91
            };
            //act
            List <int> actual = Task4.FilterDigit(testList, testNumber);

            //assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
Beispiel #7
0
        public void FilterDigitTest1()
        {
            //arrange
            List <int> testList = new List <int>()
            {
                7, 1, 2, 3, 4, 5, 6, 7, 68, 69, 70, 15, 17
            };
            int        testNumber = 7;
            List <int> expected   = new List <int>()
            {
                7, 70, 17
            };
            //act
            List <int> actual = Task4.FilterDigit(testList, testNumber);

            //assert
            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
 public void FindDigitTest_NullInputArray_ArgOutOfRangeExc(int digit, int[] array)
 {
     Assert.Throws <ArgumentNullException>(() => Task4.FilterDigit(digit, array));
 }
 public void FindDigitTest_MoreThan9_ArgOutOfRangeExc(int digit, int[] array)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => Task4.FilterDigit(digit, array));
 }
 public int[] FindDigitTest(int digit, int [] array)
 {
     return(Task4.FilterDigit(digit, array));
 }