static void Main(string[] args) { Console.WriteLine(MyMath.Add(2, 4)); Console.WriteLine(MyMath.Subtract(5, 3)); Console.WriteLine(); Console.ReadLine(); }
public void AddTestWithSharedData1(int number01, int number02, int result) { MyMath m = new MyMath(); var retVal = m.Add(number01, number02); Assert.Equal(result, retVal); }
static void Main(string[] args) { MyMath m = new MyMath(); Console.WriteLine(m.Add(10, 20)); Console.ReadLine(); }
public string Add(decimal left, decimal right) { MyMath routines = new MyMath(); decimal value = routines.Add(left, right); return($"{left} plus {right} is: {value}"); }
public string Add(decimal Left, decimal Right) { MyMath routines = new MyMath(); decimal Result = routines.Add(Left, Right); return($"{Left} plus {Right} is: {Result}"); }
public void TestAdd() { // verify if add returns the expected value of 0 Assert.AreEqual(0, MyMath.Add(10, -10)); // verify if add returns the expected value of 1234567890 Assert.AreEqual(1234567890, MyMath.Add(0, 1234567890)); }
public void MyMath_Add_Should_OK() { // Arrange var myMath = new MyMath(); // Act var result = myMath.Add(1, 2); // Assert Assert.AreEqual(3, result); }
public void IdentityTest() { var rand = new Random(); for (int i = 0; i < 100; i++) { var a = rand.Next(); var result1 = MyMath.Add(a, 0); var result2 = a; Assert.Equal(result1, result2); } }
public void CommutativityTest() { var rand = new Random(); for (int i = 0; i < 100; i++) { var a = rand.Next(); var b = rand.Next(); var result1 = MyMath.Add(a, b); var result2 = MyMath.Add(b, a); Assert.Equal(result1, result2); } }
void Start() { // Wir holen uns eine Referenz zu einer Instanz von MyMath, // welches auf dem selben Objekt liegt, wie dieses Script. MyMath myMath = GetComponent <MyMath>(); // Wir rufen die Function 'Add' auf, die zu unserer MyMath-Klasse gehört. // Den Wert, den diese Funktion zurück gibt, speichern wir in einer Variable namens sum. float sum = myMath.Add(1, 2); // Wir geben das Ergebnis in der Konsole aus. print(sum); }
public void RandomNumbersTest() { var rand = new Random(); for (int i = 0; i < 100; i++) { var a = rand.Next(); var b = rand.Next(); var expected = a + b; // <===!!!!! var result = MyMath.Add(a, b); Assert.Equal(expected, result); } }
public void AssocitiativityTest() { var rand = new Random(); for (int i = 0; i < 100; i++) { var a = rand.Next(); var b = rand.Next(); var c = rand.Next(); var result1 = MyMath.Add(MyMath.Add(a, b), c); var result2 = MyMath.Add(a, MyMath.Add(b, c)); Assert.Equal(result1, result2); } }
static void Main(string[] args) { Console.Title = "Statisk addition"; // Vilken statisk metod anropas? int sum = MyMath.Add(123, 456); Console.WriteLine("Summan är: {0}\n", sum); // Vilken statisk metod anropas? double anotherSum = MyMath.Add(9.87, 6.54); Console.WriteLine("Summan är: {0}\n", anotherSum); // Vilken statisk metod anropas? Console.WriteLine("Summan är: {0}\n", MyMath.Add(123, 6.54)); }
/// <summary> /// The first method to be executed by /// Execution Engine (?) /// </summary> /// <param name="args"></param> static void Main(string[] args) { Console.WriteLine("Hello C#"); // Print the Message Console.WriteLine("Enter x"); // convert the value into integer int x = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter y"); // convert the value into integer int y = Convert.ToInt32(Console.ReadLine()); // Create an instance of the Class MyMath MyMath m = new MyMath(); int addresult = m.Add(x, y); // Concate the String with Integer Console.WriteLine("Add = " + addresult); // Use the String Interpolation or aka Template String Console.WriteLine($"Add = {addresult}"); int substresult = m.Subst(x, y); Console.WriteLine($"Subsct = {substresult}"); Person per = new Person(); per.PersonId = 1001; // call setter per.PersonName = "Mahesh"; // call setter per.Age = 44; // call setter // call getter Console.WriteLine($"Person Info PersonId = {per.PersonId}" + $"PersonName = {per.PersonName}" + $"Age = {per.Age}" + $"Major / Minor = {per.PersonMajorMinor}"); Employee emp = new Employee(); emp.EmpNo = 102; emp.EmpName = "Mahesh"; Console.WriteLine($"EMpNO = {emp.EmpNo} EmpNAme = {emp.EmpName}"); Console.ReadLine(); // read a line }
static void Main(string[] args) { Console.WriteLine(MyMath.Add(2, 4)); Console.WriteLine(MyMath.Divide(5, 8)); Console.WriteLine(MyMath.Multiply(5, 2)); Console.WriteLine(MyMath.Subtract(4, 6)); // The code provided will print ‘Hello World’ to the console. // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. Console.WriteLine("Hello World!"); Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! }
static void Main(string[] args) { string s1 = "000123"; string s2 = "12345"; Console.WriteLine(s1.CompareTo(s2)); Queue <int> queue = new Queue <int>(5); Console.WriteLine(queue.Pop()); queue.Push(1); queue.Push(5); queue.Push(3); queue.Push(4); queue.Push(2); Console.WriteLine(queue.Pop()); queue.Push(6); //Console.WriteLine(queue.Pop()+"\t"+queue.Pop()); queue.Show(); long a = 123456789012345; long b = 1234567890123; long res = a + b; Console.WriteLine(res + "\n"); Console.WriteLine(MyMath.Add(a.ToString(), b.ToString())); string l = "123456789012345678901234567890"; string r = "987654321098765432109876543210"; Console.WriteLine(l + "\n" + r + "\n" + MyMath.Add(l, r)); Console.WriteLine("500+500={0}", MyMath.Add("500", "500")); Console.WriteLine("500+10500={0}", MyMath.Add("500", "10500")); Console.WriteLine(MyMath.Sub("234567892345678923456789", "123456781234567812345678")); Console.WriteLine(MyMath.Sub("12345", "12")); Console.WriteLine(MyMath.Sub("12", "12345")); }
static void Main(string[] args) { while (true) { Console.Write("Ange första tal: "); var num1 = Console.ReadLine(); Console.Write("Ange andra tal: "); var num2 = Console.ReadLine(); var calculate = new { Add = MyMath.Add(num1, num2), //Sub = MyMath.Sub(num1, num2), //Mul = MyMath.Mul(num1, num2), //Div = MyMath.Div(num1, num2), //Pow = MyMath.Pow(num1, num2) }; Console.WriteLine(calculate); Console.ReadKey(); } }
public static int Main() { Console.WriteLine(MyMath.Add <double>(3.6, 2.12)); return(0); }
public void Add_1Plus2Returned3() { double actual = MyMath.Add(1, 2); Assert.AreEqual(3, actual); }
static void Main(string[] args) { MyMath lib = new MyMath(); Console.WriteLine(lib.Add(5, 6)); }
public void AddPLus() { Assert.IsTrue(m.Add(2, 3).Equals(5)); }
public void AddTest() { Assert.AreEqual(MyMath.Add(1, 2), 3); }
public void Add1And3ShouldBe4() { var result = MyMath.Add(1, 3); Assert.Equal(4, result); }
public void AddTwoNumbersShouldReturnSum(int a, int b, int expected) { var result = MyMath.Add(a, b); Assert.Equal(expected, result); }
public void AddMinus1And3ShouldBe2() { var result = MyMath.Add(-1, 3); Assert.Equal(2, result); }
public void Add2And2ShouldBe4() { var result = MyMath.Add(2, 2); Assert.Equal(4, result); }
public void AddTest(int a, int b) { int c = MyMath.Add(a, b); Assert.Equal <int>(a + b, c); }
static void Main(string[] args) { int c = MyMath.Add(1, 2); Console.WriteLine("Result: " + c); }
public void AddTwoPositiveNumbers() { // Use the Assert class to test conditions Assert.AreEqual(1 + 2, MyMath.Add(1, 2)); }
public void Basic_add() { Assert.That(sut.Add(1, 3), Is.EqualTo(4)); }