private void button1_Click(object sender, EventArgs e) { int num_fields = 10; values = new string[num_fields]; values[0] = textBox1.Text; values[1] = textBox2.Text; values[2] = comboBox1.Text; values[3] = (checkBox1.Enabled).ToString(); values[4] = comboBox2.Text; values[5] = comboBox3.Text; values[6] = comboBox4.Text; values[7] = textBox3.Text; values[8] = textBox4.Text; values[9] = comboBox5.Text; if (check(values) == 1) { TourFactory.Add_Tour(values); textBox1.Text = (Convert.ToInt32(textBox1.Text) + 1).ToString(); textBox2.Text = ""; comboBox1.Text = ""; checkBox1.Enabled = false; comboBox2.Text = ""; comboBox3.Text = ""; comboBox4.Text = ""; textBox3.Text = ""; textBox4.Text = ""; } }
public void checkAddTour() { string[] tour = new string[10]; tour[0] = "2"; tour[1] = "tour1"; tour[2] = "VIP туры"; tour[3] = "true"; tour[4] = "hotel"; tour[5] = "Авиа"; tour[6] = "HB"; tour[7] = "35500"; tour[8] = "Доллар"; tour[9] = "Америка"; countries contr = new countries(); countries.dataCountries.Rows.Add("1", "Америка"); Countries_Col obj = new Countries_Col(); hotels hot = new hotels(); hotels.dataHotels.Rows.Add("1", "hotel", "****", "12000"); HotelFactory hotelfac = new HotelFactory(); tours formTour = new tours(); tours.dataTours.Rows.Add("1", "tour", "VIP туры", "Россия", "True", "hotel", "Автобус", "BB", "12000", "Рубль"); FoodCol food = new FoodCol(); TransportCol tr = new TransportCol(); TourTypeCol tourtype = new TourTypeCol(); TourFactory factTour = new TourFactory(); int a = TourFactory.count(); TourFactory.Add_Tour(tour); Assert.AreEqual(a + 1, TourFactory.count()); }