public void DecimalsCorrectInputs()
 {
     try
     {
         string       numberInput  = Convert.ToString(TestContext.DataRow["Number"]);
         string       numberOutput = Convert.ToString(TestContext.DataRow["Text"]);
         NumberTester numberClass  = new NumberTester();
         string       actual_value = numberClass.ToText(numberInput);
         Assert.AreEqual(numberOutput, actual_value);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Esempio n. 2
0
 public void TestingPerformance()
 {
     try
     {
         string       resultPath   = "ConverterPerformanceResults.txt";
         NumberTester numberTester = new NumberTester();
         using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(resultPath))
         {
             DecimalRandom decimalRandom = new DecimalRandom();
             for (int i = 0; i <= 10000; i++)
             {
                 decimal randomNumber        = decimalRandom.NextDecimal();
                 string  randomDecimal       = Convert.ToString(randomNumber);
                 string  randomDecimalInText = numberTester.ToText(Convert.ToString(randomNumber));
                 streamWriter.WriteLine(randomDecimal + "\t\t\t" + randomDecimalInText);
             }
         }
     }
     catch (Exception ex)
     {
         Assert.Fail("Performace test error.");
     }
 }
 public void DecimalsIncorrectInputs()
 {
     string       numberInput  = Convert.ToString(TestContext.DataRow["Number"]);
     NumberTester numberClass  = new NumberTester();
     string       actual_value = numberClass.ToText(numberInput);
 }
 public void IntegersInvalidRangeValues()
 {
     string       numberInput  = Convert.ToString(TestContext.DataRow["Number"]);
     NumberTester numberClass  = new NumberTester();
     string       actual_value = numberClass.ToText(numberInput);
 }