public void cekHowManyDup() { int[] numbers = { 1, 3, 5, 1, 4, 5, 2, 4, 3, 5, 3, 1 }; string hasil = "jumlah 1 sebanyak 3\n" + "jumlah 3 sebanyak 3\n" + "jumlah 5 sebanyak 3\n" + "jumlah 4 sebanyak 2\n" + "jumlah 2 sebanyak 1\n"; Assert.Equal(hasil, HowManyDuplicates.Run(numbers)); }
public void tes_how_many_duplicate() { int[] dups = { 1, 3, 5, 1, 4, 5, 2, 4, 3, 5, 3, 1 }; var expected = new SortedList <int, int>(); expected.Add(1, 3); expected.Add(2, 1); expected.Add(3, 3); expected.Add(4, 2); expected.Add(5, 3); Assert.Equal(expected, HowManyDuplicates.Run(dups)); }