public void GetNullListReturnArgumentNullException() { FilterDigitClass class1 = new FilterDigitClass(); List <int> inputList = null; int digit = 3; Assert.ThrowsException <ArgumentNullException>(() => class1.FilterDigit(inputList, digit)); }
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)); }
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); }
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(); }
public void CheckOnEmpty() => Assert.Throws <ArgumentException>(() => FilterDigitClass.FilterDigit(-1, new int[] { }));
public void CheckOnNull() => Assert.Throws <ArgumentNullException>(() => FilterDigitClass.FilterDigit(-1, null));
public int[] FilterDigitTests(int number, int[] array) => FilterDigitClass.FilterDigit(number, array);
public int[] FilterDigitTestCase2(int[] array) { array = FilterDigitClass.FilterDigit(new DigitPredicate(0), array); return(array); }