Пример #1
0
        public void BandBColorCodeTableLookupTest([ValueSource(typeof(OhnValueCalculatorTestData), "Colors")] ColorCodes x,
                                                  [ValueSourceAttribute(typeof(OhnValueCalculatorTestData), "BandBColumn")] Bands position,
                                                  [ValueSource(typeof(OhnValueCalculatorTestData), "BandBResults")] double ohm)
        {
            IOhmValueCalculator instance = CreateInstance();

            if (ohm >= 0)
            {
                var sutOhms = instance.TableLookup(x, position);
                Assert.AreEqual(sutOhms, ohm);
            }

            else
            {
                try
                {
                    var sutOhmsInvalid = instance.TableLookup(x, position);
                    Assert.AreEqual(true, false); //ohm < 0 denotes invalid table values, so it should not pass
                }
                catch
                {
                    Assert.AreEqual(true, true);//instead exception should occur
                }
            }
        }