예제 #1
0
        public void DecimalToHex_convertedCorrectly_NoExceptionsThrown()
        {
            Random random = new Random();

            for (int i = 0; i < 50_000; i++)
            {
                int number = random.Next(i, int.MaxValue);

                Assert.DoesNotThrow(() => HexadecimalConvert.ConvertDecimalToHex(number), $"decimal {number} did not convert");
            }
        }
예제 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (RadioToBase16.Checked)
         {
             TxtOutPut.Text = HexadecimalConvert.ConvertDecimalToHex(int.Parse(txtInput.Text));
         }
         else
         {
             TxtOutPut.Text = HexadecimalConvert.ConvertHexToDecimal(txtInput.Text).ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #3
0
        public void Hexadecimal_Case3_convertedCorrectly_DecimalValues()
        {
            var value = HexadecimalConvert.ConvertDecimalToHex(8500);

            Assert.AreEqual("2134", value);
        }
예제 #4
0
        public void Hexadecimal_Case2_convertedCorrectly_DecimalValues()
        {
            var value = HexadecimalConvert.ConvertDecimalToHex(190);

            Assert.AreEqual("BE", value);
        }