Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace CollectionModif
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> numberlist = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 76, 78, 8, 55 };
- int[] numberarray = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
- foreach (int element in ModCollection.NotEvenElement(numberarray))
- {
- Console.Write(element);
- }
- ModCollection.CollectionEvenRizor(numberlist);
- Console.WriteLine("");
- foreach (int element in numberlist)
- {
- Console.WriteLine(element);
- }
- // ТЕСТЫ
- List<int> testlist = new List<int> { };
- ModCollection.CollectionEvenRizor(testlist);
- if (testlist.Count == 0)
- {
- Console.WriteLine("Test null List PASS");
- }
- else
- {
- Console.WriteLine("Test null List FAILED");
- }
- List<int> testlist1 = new List<int> { 2, 2, 2, 2, 2, 2 };
- ModCollection.CollectionEvenRizor(testlist1);
- if (testlist1.Count == 0)
- {
- Console.WriteLine("Test Even List PASS");
- }
- else
- {
- Console.WriteLine("Test Even List FAILED");
- }
- List<int> testlist2 = new List<int> { 1, 3, 5, 7, 9, 11 };
- ModCollection.CollectionEvenRizor(testlist2);
- if (testlist2.Count == 6)
- {
- Console.WriteLine("Test dont Even List PASS");
- }
- else
- {
- Console.WriteLine("Test dont Even List FAILED");
- }
- List<int> testlist3 = new List<int> { 1 };
- int countbeforRizor = testlist3.Count;
- ModCollection.CollectionEvenRizor(testlist3);
- if (testlist3.Count == countbeforRizor)
- {
- Console.WriteLine("Test short dont Even List PASS");
- }
- else
- {
- Console.WriteLine("Test short dont Even List FAILED");
- }
- List<int> testlist4 = new List<int> { 3 };
- ModCollection.CollectionEvenRizor(testlist4);
- if (testlist4[0] == 1)
- {
- Console.WriteLine("Test short Even List PASS");
- }
- else
- {
- Console.WriteLine("Test short Even List FAILED");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement