public void TestMyListWithNoElements() { Summ summer = new Summ(); var emptyList = new List <int>(); Assert.AreEqual(0, summer.SumMyNumbersBitch(emptyList)); }
public void TestMyListWithOneElement() { Summ summer = new Summ(); var oneElementList = new List <int>(); oneElementList.Add(15); Assert.AreEqual(15, summer.SumMyNumbersBitch(oneElementList)); }
public void TestMyListWithNull() { Summ summer = new Summ(); var nullList = new List <int>(); nullList = null; Assert.AreEqual(null, summer.SumMyNumbersBitch(nullList)); }
//данная функция создает пример наквадратике public void create_example(string example, int answer) { //int a = Random.Range (1,9); //int b = Random.Range (1, 9); Summ sum = new Summ(); example = sum.StrExample(); answer = sum.Answer(); }
static void Main(string[] args) { int a = 1; int b = 3; int c = 7; Summ summ = (aa, bb, cc) => (double)(aa + bb + cc) / 3; Console.WriteLine(summ(a, b, c)); Console.Read(); }
private void OK_Click(object sender, EventArgs e) { if (PIB.Text.Length == 0 || Passport.Text.Length == 0 || Summ.Text.Length == 0) { MessageBox.Show("Всі поля мають бути заповнені!"); } else { string pib = PIB.Text; int passport = int.Parse(Passport.Text); string operation = Operation.SelectedItem.ToString(); string valuta = Currency.SelectedItem.ToString(); float summ = float.Parse(Summ.Text); DB db = new DB(); DataTable table = new DataTable(); DataTable table2 = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(); MySqlCommand query = new MySqlCommand("INSERT INTO `clients`(`id`, `PIB`, `passport`, `operation`, `valuta`, `summ`) VALUES ('','" + pib + "','" + passport + "','" + operation + "','" + valuta + "','" + summ + "')", db.GetConnection()); MySqlCommand query2 = new MySqlCommand("SELECT `Buy`,`Sell` FROM `exchangerate` WHERE `title` = '" + valuta + "'", db.GetConnection()); adapter.SelectCommand = query; adapter.Fill(table); adapter.SelectCommand = query2; adapter.Fill(table2); SummUAH.Visible = true; label3.Visible = true; float[,] values = new float[table2.Rows.Count, table2.Columns.Count]; for (int i = 0; i < table2.Rows.Count; i++) { DataRow row = table2.Rows[i]; for (int j = 0; j < table2.Columns.Count; j++) { values[i, j] = (float)row[j]; } } float result = values[0, 0] * summ; SummUAH.Text = result.ToString(); PIB.Clear(); Passport.Clear(); Summ.Clear(); Operation.SelectedItem = "Купівля"; Currency.SelectedItem = 0; } }
public void TestMySumaOfList() { Summ summer = new Summ(); var szamosLista = new List <int>(); szamosLista.Add(15); szamosLista.Add(15); szamosLista.Add(5); szamosLista.Add(18); Assert.AreEqual(53, summer.SumMyNumbersBitch(szamosLista)); }
public override int GetHashCode() { var hashCode = 1754935533; hashCode = hashCode * -1521134295 + Date.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Customer); hashCode = hashCode * -1521134295 + Status.GetHashCode(); hashCode = hashCode * -1521134295 + Prepaid.GetHashCode(); hashCode = hashCode * -1521134295 + Summ.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Description); return(hashCode); }
public Example MakeExample(int i) { Example ex = new Summ(); switch (i) { case 0: ex = new Summ(); break; case 1: ex = new DifferenceEx(); break; case 2: ex = new Multiplication(); break; case 3: ex = new Division(); break; } return(ex); }
static void Main(string[] args) { Console.WriteLine(Colors.Pink); Message message = a => a; //The simple lambda expression Console.WriteLine(message("test")); string test2 = message("test2"); Console.WriteLine(test2); Summ summ = (a, b) => a + b; Console.WriteLine(summ(5, 5)); Hello hello1 = () => Console.WriteLine("Hello Masha"); hello1(); Hello hello2 = () => GoodEveningMasha(); hello2(); Hello hello; if (DateTime.Now.Hour < 12) { hello = GoodMorning; } else { hello = GoodEvening; } hello(); PrintTheName(); Console.ReadKey(); }
// расчет private void work_Click(object sender, EventArgs e) { Summ.Clear(); Numbers.Clear(); int k, Sum; // проверка конвертации if (Int32.TryParse(Koll.Text, out k) == true) { // вызов функии из библиотеки Sum = Lib_1.RandomAmount.Go(k, Numbers); Summ.Text = Sum.ToString(); } else { Koll.Clear(); MessageBox.Show("Введите корректное значение!"); } }
public List <string> ToStringList() { List <string> result = new List <string>(20); result.Add(Number.ToString()); result.Add(Name); result.Add(Birthday); result.Add(Level); result.Add(State); result.Add(Sity); result.Add(Assotiation); result.Add(Club); result.Add(Weight.ToString()); result.Add(kWilis.ToString()); result.Add(Trainers); //result.Add(Prised); result.Add(p1.ToString()); result.Add(p2.ToString()); result.Add(p3.ToString()); result.Add(j1.ToString()); result.Add(j2.ToString()); result.Add(j3.ToString()); result.Add(t1.ToString()); result.Add(t2.ToString()); result.Add(t3.ToString()); //result.Add(Jym); //result.Add(Taga); result.Add(Alpha); result.Add(Summ.ToString()); result.Add(Place.ToString()); result.Add(NormFlag.ToString()); result.Add(SummKU.ToString()); result.Add(Points.ToString()); return(result); }
/// <summary> /// Возвращает samples суммы строчными буквами. /// </summary> public string ToWords(decimal summ) { return(Summ.ToWords(summ, this)); }
/// <summary> /// Возвращает samples суммы. /// </summary> public string ToWords(double summ, Capital capital) { return(Summ.ToWords(summ, this, capital)); }
/// <summary> /// Возвращает samples суммы строчными буквами. /// </summary> public string ToWords(double summ) { return(Summ.ToWords(summ, this)); }
// сброс private void reset_Click(object sender, EventArgs e) { Summ.Clear(); Numbers.Clear(); Koll.Clear(); }
// изменение входного текстбокса private void sourceK_TextChanged(object sender, EventArgs e) { Summ.Clear(); Numbers.Clear(); Koll.Clear(); }