Пример #1
0
        /// <summary>
        /// Кнопка рандомного элемента
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void randomelement_Click(object sender, EventArgs e)
        {
            ICircuit randomCircuit;
            var      random      = new Random();
            var      elementType = random.Next(3);

            if (elementType == 0)
            {
                randomCircuit = new Resistor()
                {
                    Resistance = random.Next(500)
                };
            }
            else if (elementType == 1)
            {
                randomCircuit = new Capacitor()
                {
                    Capacitance = random.Next(9000000)
                };
            }
            else
            {
                randomCircuit = new Induct()
                {
                    Inductance = random.Next(9000000)
                };
            }
            listCircuit.Add(randomCircuit);
            var row = _datatable.NewRow();

            row[0] = randomCircuit.Name;
            row[1] = Convert.ToString(randomCircuit.CalculateValue(Convert.ToDouble(FrequencyTextBox.Text)));
            _datatable.Rows.Add(row); //Добавление строки
            dataGridView1.Update();   //Обновление таблицы
        }
Пример #2
0
        public void Inductance_Negativetest(int inductance)
        {
            var induct = new Induct();

            Assert.Throws(typeof(ArgumentException), () => { induct.Inductance = inductance; });
        }
Пример #3
0
        public void Inductance_Test(int inductance)
        {
            var induct = new Induct();

            induct.Inductance = inductance;
        }