예제 #1
0
            public void Given_valid_arguements_when_Add_invoke_Then_Valid_Result_Asserted()
            {
                calculate.Addition(10, 20);
                calculate.Addition(10, 20);
                calculate.Addition(10, 20);
                calculate.Addition(10, 20);

                _mockWrapper.Verify(fakeNeighbour => fakeNeighbour.write("Add method Invoked"), Moq.Times.Exactly(4));
            }
예제 #2
0
        public void AdditionTests()
        {
            Calculate cal = new Calculate();

            cal.Addition(10, 5);
            Console.WriteLine("Testing 10+5");
            Assert.AreEqual(15, cal.Output());
            cal.Addition(-5, 10);
            Console.WriteLine("Testing -5+10");
            //Assert.AreEqual(15, cal.Output());
        }
예제 #3
0
    static void Main(string[] args)
    {
        Calculate.Addition(10, 50);
        Calculate objCal = new Calculate();

        objCal.Multiply(10, 20);
    }
예제 #4
0
        static void Main(string[] args)
        {
            Calculate calculate = new Calculate();

            result = calculate.Addition(25, 36);
            Console.WriteLine("Result " + result);
        }
예제 #5
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     CheckValues();
     if (calc.isIncorrect == false)
     {
         Output.Text = calc.Addition().ToString();
     }
 }
예제 #6
0
        static void Main(string[] args)
        {
            Calculate c = new Calculate(2, 3);

            c.Addition();


            Console.WriteLine(c);
        }
예제 #7
0
        public void AdditionReturnFour()
        {
            ////Arrange
            Calculate calculation = new Calculate();

            //ACT
            double number = calculation.Addition(2, 2);

            //ASSERT
            Assert.Equal(4, number);
        }
예제 #8
0
 protected void equalsbutton_Click(object sender, EventArgs e)
 {
     if (numberdisplay.Text == string.Empty)
     {
         Response.Write("<script>alert('Brak danych')</script>");
     }
     else
     {
         ViewState["x2"]    = numberdisplay.Text;
         numberdisplay.Text = string.Empty;
         try
         {
             if ((string)ViewState["Operation"] == "Addition")
             {
                 numberdisplay.Text = _Calculate.Addition(Convert.ToInt32(ViewState["x1"]), Convert.ToInt32(ViewState["x2"])).ToString();
             }
             else if ((string)ViewState["Operation"] == "Subtraction")
             {
                 numberdisplay.Text = _Calculate.Subtraction(Convert.ToInt32(ViewState["x1"]), Convert.ToInt32(ViewState["x2"])).ToString();
             }
             else if ((string)ViewState["Operation"] == "Multiplication")
             {
                 numberdisplay.Text = _Calculate.Multiply(Convert.ToInt32(ViewState["x1"]), Convert.ToInt32(ViewState["x2"])).ToString();
             }
             else if ((string)ViewState["Operation"] == "Division")
             {
                 if (Convert.ToInt32(ViewState["x2"]) == 0)
                 {
                     Response.Write("<script>alert('Nie dziel przez 0!')</script>");
                 }
                 numberdisplay.Text = _Calculate.Division(Convert.ToInt32(ViewState["x1"]), Convert.ToInt32(ViewState["x2"])).ToString();
             }
             else
             {
                 Response.Write("<script>alert('Brak wybranej operacji')</script>");
             }
         }
         catch (FormatException)
         {
             Response.Write("<script>alert('Zły format danych')</script>");
         }
     }
 }
예제 #9
0
 public void AdditionTest()
 {
     _cal.Addition();
     Assert.IsTrue(_cal.Answer == 5);
 }
예제 #10
0
 public void TestAddition()
 {
     Assert.AreEqual(5, Calculate.Addition(2, 3));
 }
예제 #11
0
        public double Add(double num1, double num2)
        {
            Calculate add = new Calculate();

            return(add.Addition(num1, num2));
        }