Exemple #1
0
 public void TestRes()
 {
     var c = new Calculator();
     int n1 = 5;
     int n2 = 2;
     Assert.AreEqual(n1 - n2, c.Res(n1, n2));
 }
Exemple #2
0
 public void TestSum()
 {
     var c = new Calculator();
     int n1 = 10;
     int n2 = 3;
     Assert.AreEqual(n1 + n2, c.Sum(n1, n2));
 }
Exemple #3
0
 public void TestDiv()
 {
     var c = new Calculator();
     int n1 = 10;
     int n2 = 2;
     Assert.AreEqual(n1 / n2, c.Div(n1, n2));
 }
Exemple #4
0
 public void TestMul()
 {
     var c = new Calculator();
     int n1 = 3;
     int n2 = 3;
     Assert.AreEqual(n1 * n2, c.Mul(n1, n2));
 }
Exemple #5
0
        /*static void Main(string[] args)
        {
            var cat = new Cat();
            var dog = new Dog();

            WriteAnimalSound(cat);

            Console.ReadLine();

        }*/
        static void Main(string[] args)
        {
            Calculator calculator = new Calculator(3,1);
               /* int calculatorResultSum = calculator.Sum();

            int staticResult = StaticCalculator.StaticSum(3, 5);

            int calculatorResultMultiplicator = calculator.Multiplicator();

            int staticResultMultiplicator = StaticCalculator.StaticMultiplicator(3, 2);*/

            float calculatorResultDivision = calculator.Division();

            Console.WriteLine(calculatorResultDivision.TwoDecimals()); //Para que siempre muestre dos decimales

            Console.ReadLine();
        }
 public void TestSub()
 {
     var calc = new Calculator();
     var result = calc.Sub(2, 3);
     Approvals.Verify(result);
 }
Exemple #7
0
 public void should_be_0_if_empty_string_inputted(string input, int expectedSum)
 {
     var sum = new Calculator().Add(input);
     Assert.That(sum, Is.EqualTo(expectedSum));
 }
 public void CanCalculateSimpleExpressions()
 {
     var action = new Calculator();
     action.ActOn(new TextItem("21 + 21"));
     Assert.Equal("42", action.Text);
 }
 public void CanCalculatePowerOf2Expressions()
 {
     var action = new Calculator();
     action.ActOn(new TextItem("pow(10,2)"));
     Assert.Equal("100", action.Text);
 }