public void FilterDivision_FilterString_BigValues_DivisionTimeLess()
        {
            int[] array = GenerateIntValues(10000, 10);
            int   value = 2;

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            DigitWorker.FilterDivision(value, new IntContain(), array);
            stopwatch.Stop();

            long divisionTime = stopwatch.ElapsedMilliseconds;

            stopwatch.Restart();
            DigitWorker.FilterString(value, array);
            stopwatch.Stop();

            long stringTime = stopwatch.ElapsedMilliseconds;

            bool isBigger = false;

            if (stringTime < divisionTime)
            {
                isBigger = true;
            }

            Assert.IsFalse(isBigger);
        }
        public void FilterDivision_WithIntValues_ReturnExampleResult()
        {
            int[] array = { 3, 56, 456, 234, 7, 98, 5 };
            int   value = 5;

            int[] expected = { 56, 456, 5 };

            int[] actual = DigitWorker.FilterDivision(value, new IntContain(), array);

            CollectionAssert.AreEqual(expected, actual);
        }
        public void Filter_WithoutValue_ReturnEmptyArray()
        {
            int[] array = { 7, 1, 2, 3, 5, 6, 7, 68, 69, 70, 15, 17 };
            int   value = 4;

            int[] expected = { };

            int[] actual = DigitWorker.FilterDivision(value, new IntContain(), array);

            CollectionAssert.AreEqual(expected, actual);
        }
        public void Filter_WithLongValues_ReturnExprctedArray()
        {
            int[] array = { -700, 551, 20005, 300, 135, 633389, 7324687, 11, 64569, 70, 15, 173333, 112 };
            int   value = 5;

            int[] expected = { 551, 20005, 135, 64569, 15 };

            int[] actual = DigitWorker.FilterDivision(value, new IntContain(), array);

            CollectionAssert.AreEqual(expected, actual);
        }
        public void Filter_WithExampleValues_ReturnExprctedArray()
        {
            int[] array = { 7, 1, 2, 3, 4, 5, 6, 7, 68, 69, 70, 15, 17 };
            int   value = 7;

            int[] expected = { 7, 7, 70, 17 };

            int[] actual = DigitWorker.FilterDivision(value, new IntContain(), array);

            CollectionAssert.AreEqual(expected, actual);
        }
        public void FilterDivision_FromDataSource_ReturnDataSourceResult()
        {
            string elementsFromDb = TestContext.DataRow["Element"].ToString();

            int[] elements = ParseToIntArray(elementsFromDb);

            int value;

            if (int.TryParse(TestContext.DataRow["CheckValue"].ToString(), out value))
            {
                string expectedFromDb = TestContext.DataRow["Expected"].ToString();
                int[]  expected       = ParseToIntArray(expectedFromDb);

                int[] actual = DigitWorker.FilterDivision(value, new IntContain(), elements);

                CollectionAssert.AreEqual(expected, actual);
            }
        }
 public void FilterDivision_WithNull_ThrowArgumentNullException()
 => DigitWorker.FilterDivision(1, new IntContain(), null);
 public void Filter_WithNull_ThrowArgumentNullException()
 => Assert.Throws <ArgumentNullException>(() => DigitWorker.FilterDivision(1, new IntContain(), null));