public void AllInformation6335Test1() { string[] expectedResult = new string[] { "6,Common", "7,Student", "8,Child", "9,Old" }; string input = "CustomerType6335"; Assert.AreEqual(true, Enumerable.SequenceEqual(expectedResult, ReadFromEnum6335.AllInformation6335(input))); }
public void AllInformation6335Test2() { string[] expectedResult = new string[] { "1,高中", "2,中专", "11,大专", "12,本科", "13,硕士", "14,博士" }; string input = "Degree6335"; Assert.AreEqual(true, Enumerable.SequenceEqual(expectedResult, ReadFromEnum6335.AllInformation6335(input))); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string selected = comboBox1.SelectedItem.ToString(); //获取下拉列表中的枚举类型名称 IEnumerator <string> result = ReadFromEnum6335.AllInformation6335(selected).GetEnumerator(); //将结果传入集合 string[] text = new string[10]; //定义一个存放枚举集合值的数组 int i = 0; //MoveNext 将 Current 设置为下一个元素 while (result.MoveNext()) { text[i++] = result.Current; //遍历结果集,传入集合当前位置元素到数组 } textBox1.Lines = text; //显示 }