Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            int x = Convert.ToInt32(args[0]);
            int y = Convert.ToInt32(args[1]);

            Console.WriteLine(SubtractClass.Subtract(x, y));
        }
Ejemplo n.º 2
0
 public void SubtractTest()
 {
     // Prepare test case
     double[] aArray = new double[] { 2.0, 3.0 };
     double[] bArray = new double[] { 1.0, 2.0 };
     double[] subtructExpectedArray = new double[] { 1.0, 1.0 };
     for (int i = 0; i < 2; i++)
     {
         double a = aArray[i];
         double b = bArray[i];
         double subtructExpected = subtructExpectedArray[i];
         Assert.AreEqual(SubtractClass.Subtract(a, b), subtructExpected);
     }
 }
 public void PositiveInputNegativeResult()
 {
     Assert.Equal(SubtractClass.Subtract(1, 2), -1);
 }
 public void PositiveSubtractionOverLimitOneNumberNearLimit()
 {
     Assert.Throws <OverflowException>(() => SubtractClass.Subtract(2147483647, -20));
 }
 public void PositiveSubtractionOverLimitTwoNumbersNearLimit()
 {
     Assert.Throws <OverflowException>(() => SubtractClass.Subtract(-2147483647, 2147483647));
 }
 public void NegativeInputPositiveResult()
 {
     Assert.Equal(SubtractClass.Subtract(-10, -30), 20);
 }
 public void NegativeInputNegativeResult()
 {
     Assert.Equal(SubtractClass.Subtract(-18, -11), -7);
 }
 public void PositiveInputPositveResult()
 {
     Assert.Equal(SubtractClass.Subtract(10, 3), 7);
 }