public int EvaluateThis(string expression) { calculate.IdentifyOperator(expression); switch (calculate.myDelimeter) { case '+': return(Calculation.Addition(calculate.firstNumber, calculate.secondNumber)); case '-': return(Calculation.Substraction(calculate.firstNumber, calculate.secondNumber)); case '*': return(Calculation.Multiplication(calculate.firstNumber, calculate.secondNumber)); case '/': return(Calculation.Division(calculate.firstNumber, calculate.secondNumber)); case '%': return(Calculation.Modulus(calculate.firstNumber, calculate.secondNumber)); default: throw new ArgumentException(); } }
public void Addition() { double expected = 2; double actual = Calculation.Addition(1, 1); Assert.AreEqual(expected, actual); }
public void CheckMultipleAdditions(int expectedValue, int value1, int value2) { Calculation calculation = new Calculation(); int acutalValue = calculation.Addition(value1, value2); Assert.Equal(expectedValue, acutalValue); }
public void CheckMultipleAddition(int expectedValue, int value1, int value2) { Calculation calculation = new Calculation(); //Samma som ovan men inparam + [] int actualValue = calculation.Addition(value1, value2); Assert.Equal(expectedValue, actualValue); }
public void CheckSimpleAddition() { int expectedValue = 6; Calculation calculation = new Calculation(); //Det värde som metoden levererar int acutalValue = calculation.Addition(3, 3); //Jämför förväntat värde med vad som levereras Assert.Equal(expectedValue, acutalValue); }
public void CheckSimpleAddition() { //Vad ska resultatet bli? int expectedValue = 6; //SKapa upp klassen + using namespace där calculation finns Calculation calculation = new Calculation(); //Anropa klassen med 2 värden o kolla om svaret är det den ska generera int actualValue = calculation.Addition(3, 3); //Göra kontroll Assert.Equal(expectedValue, actualValue); //Om den leverear tru så är det rätt annars fail + [Fact] }
static void Main(string[] args) { Calculation cal = new Calculation(); Console.WriteLine("number1 value:"); int n1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("number2 value:"); int n2 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Addition:" + cal.Addition(n1, n2)); Console.WriteLine("Subtraction:" + cal.Subtraction(n1, n2)); Console.WriteLine("Multiplication:" + cal.Multiplication(n1, n2)); Console.WriteLine("Division:" + cal.Division(n1, n2)); Console.ReadLine(); }
static void Main(string[] args) { Calculation cal = new Calculation(); Console.WriteLine("Enter the n1:"); int n1 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the n2:"); int n2 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Addition of two numbers:" + cal.Addition(n1, n2)); Console.WriteLine("Subtraction of two numbers:" + cal.Subtraction(n1, n2)); Console.WriteLine("Multiplication of two numbwers:" + cal.Multiplication(n1, n2)); Console.WriteLine("Division of two numbers:" + cal.Division(n1, n2)); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("\n"); Calculation calculator = new Calculation(); Console.WriteLine("Addition\n" + "Expected 4"); Console.WriteLine(calculator.Addition(2, 2)); Console.WriteLine("\n" + "Substraction\n" + "Expected 1"); Console.WriteLine(calculator.Substraction(4, 3)); Console.WriteLine("\n" + "Multiply\n" + "Expected 10"); Console.WriteLine(calculator.Multiply(5, 2)); Console.WriteLine("\n" + "Divide\n" + "Expected 4"); Console.WriteLine(calculator.Divide(8, 2)); }
public void TestCorrectNumber() //Test correct sum { //Catch Captcha number Before pressing submit button PageObject page = new PageObject(); var beforesubmit = page.BoxNameField(); Console.WriteLine("Captcha before pressing submit button: " + beforesubmit); //Getting sum from the two numbers in captcha box var correctResult = Calculation.Addition(beforesubmit); //Filling correct number into captcha box page.SubmitForm("Viktor", "Hello there!", correctResult); Console.WriteLine("Sum of the two numbers is " + correctResult); System.Threading.Thread.Sleep(6500); //Verifying that success message is "Success" var MessageSuccessSubmitForm = page.GetSucessErrorMsgText(); Console.WriteLine("Message is: " + MessageSuccessSubmitForm); Assert.AreEqual("Success", MessageSuccessSubmitForm); }
public void AdditionTests(int a, int b, int expected) { var actual = Calculation.Addition(a, b); Assert.Equal(expected, actual); }