static void Main(string[] args) { var r = new ResistorValueCalculator("Green", "blue", "black", "gold", "brown"); Console.WriteLine(r); r = new ResistorValueCalculator("Red", "red", "orange", "gold"); Console.WriteLine(r); r = new ResistorValueCalculator("Yellow", "violet", "brown", "gold"); Console.WriteLine(r); r = new ResistorValueCalculator("Blue", "grey", "black", "gold"); Console.WriteLine(r); Console.ReadKey(); }
public void Initialize() { _Calculator = new ResistorValueCalculator(); }
public void FiveBand(string color1, string color2, string color3, string color4, string color5, string expected) { var calculator = new ResistorValueCalculator(color1, color2, color3, color4, color5); Assert.Equal(expected, calculator.ToString()); }
/// <summary> /// Calculates the Ohm value of a resistor based on the band colors. /// </summary> /// <remarks> /// This method is flawed. It's unable to return decimal ohms value or tolerance values. /// </remarks> /// <param name="bandAColor">The color of the first figure of component value band.</param> /// <param name="bandBColor">The color of the second significant figure band.</param> /// <param name="bandCColor">The color of the decimal multiplier band.</param> /// <param name="bandDColor">The color of the tolerance value band.</param> public int CalculateOhmValue(string bandAColor, string bandBColor, string bandCColor, string bandDColor) { var calculator = new ResistorValueCalculator(bandAColor, bandBColor, bandCColor, bandDColor); return((int)calculator.Ohms); }