Beispiel #1
0
        public void DoPairTest()
        {
            List<string> boyNames = new List<string>();
            boyNames.Add("boy1");
            boyNames.Add("boy2");
            boyNames.Add("boy3");
            boyNames.Add("boy4");
            boyNames.Add("boy5");
            boyNames.Add("boy6");
            boyNames.Add("boy7");
            boyNames.Add("boy8");

            List<string> list = boyNames; // TODO: 初始化为适当的值
            int groupmembercount = 2; // TODO: 初始化为适当的值

            RandomPair target = new RandomPair(list, groupmembercount); // TODO: 初始化为适当的值
             // TODO: 初始化为适当的值
            Dictionary<int, List<string>> actual;
            actual = target.DoPair();

            foreach (int i in actual.Keys)
            {
                Console.Write(i);
                foreach (string s in actual[i])
                {
                    Console.Write(s);
                }
                Console.WriteLine();
            }

            Assert.AreEqual(4, actual.Count);
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            rtResult.ResetText();
            List<string> list=new List<string>();
            list.AddRange(rtBoy.Lines);

            rtResult.AppendText("男子组"+Environment.NewLine);
            RandomPair rp = new RandomPair(list, 4);
            DisplayResult(rp.DoPair());
            rtResult.AppendText("女子组" + Environment.NewLine);
            List<string> list2 = new List<string>();
            list2.AddRange(rtGirl.Lines);
            RandomPair rp2 = new RandomPair(list2, 3);
            DisplayResult(rp2.DoPair());
        }