static void Main(string[] args) { IElement resistor = new Resistor(); resistor.Value = 15.0; resistor.Name = "R1"; var impedanceR = resistor.GetImpedance(1.0); Console.WriteLine(impedanceR.ToString()); IElement inductor = new Inductor(); inductor.Value = 25.0; inductor.Name = "L1"; var impedanceI = inductor.GetImpedance(33); Console.WriteLine(impedanceI.ToString()); IElement capacitor = new Capacitor(); capacitor.Value = 32.2; capacitor.Name = "C1"; var impendanceC = capacitor.GetImpedance(22); Console.WriteLine(impendanceC.ToString()); }
public void GetImpedanceTest(double resultReal, double resulrImaginary, double angularFrequency, double value) { var resistor = new Resistor(value); var impedance = resistor.GetImpedance(angularFrequency); Assert.AreEqual(resultReal, impedance.Real); Assert.AreEqual(resulrImaginary, impedance.Imaginary); }