Esempio n. 1
0
        public void ReceivesExceptionIfParameterBandsAreInappropriate()
        {
            try
            {
                var propertyDecoder = new ResisterPropertyDecoder();
                propertyDecoder.CalculateOhmValue("PK", "RD", "WH", "OG");
                Assert.Fail();
            }
            catch (Exception exc)
            {
            }

            try
            {
                //Tolerance value fault
                var propertyDecoder = new ResisterPropertyDecoder();
                propertyDecoder.CalculateOhmValue("WH", "VT", "BK", "PK");
                Assert.Fail();
            }
            catch (Exception exc)
            {
            }
            try
            {
                //Multiplier value fault
                var propertyDecoder = new ResisterPropertyDecoder();
                propertyDecoder.CalculateOhmValue("BK", "BN", "None", "RD");
                Assert.Fail();
            }
            catch (Exception exc)
            {
            }
        }
Esempio n. 2
0
 public void ReceivesExceptionIfParameterNamesAreInvalid()
 {
     try
     {
         var propertyDecoder = new ResisterPropertyDecoder();
         propertyDecoder.CalculateOhmValue("", "asdfasdf", "brandBColor", "White");
         Assert.Fail();
     }
     catch (Exception exc)
     {
     }
 }
Esempio n. 3
0
 public void WillNotOverflowOnCalcuation()
 {
     try
     {
         var propertyDecoder = new ResisterPropertyDecoder();
         propertyDecoder.CalculateOhmValue("WH", "WH", "WH", "M");
     }
     catch (ArithmeticException exc)
     {
         Assert.Fail(exc.Message);
     }
     catch (Exception exc)
     {
         Assert.Fail(exc.Message);
     }
 }
Esempio n. 4
0
        public void ProducesNumericResultForCorrectBandConfiguration()
        {
            var propertyDecoder = new ResisterPropertyDecoder();

            Assert.AreEqual(propertyDecoder.CalculateOhmValue("GN", "BU", "BN", "BN"), 565); //560 ohms + 1% truncating the decimal per Json's feedback.
        }