public static Add ( int a, int b ) : int | ||
a | int | |
b | int | |
Результат | int |
static void Main(string[] args) { SimpleMath p = new SimpleMath(); int x = p.Add(2, p.Add(3, p.Add(3, -3 + p.Add(3, 40)))); Console.WriteLine("Hello World" + x); Console.ReadLine(); }
public RecordingAttributeTest() { saverMock = new Mock<ISaveRecordings>(); saverMock.Setup(saver => saver.SaveMethodRecording(It.IsAny<MethodRecording>())).Verifiable(); RecordingServices.RecordingSaver = saverMock.Object; RecordingServices.RecordingNamer = new TypeAndMethodNamer(); recorder = (DefaultRecorder)RecordingServices.Recorder; recorder.ClearRecordings(); math = new SimpleMath(); math.Add(5, 5); math.Add(10, 10); SimpleMath.AddStatic(15, 15); }
public RecordingAttributeTest() { saverMock = new Mock <ISaveRecordings>(); saverMock.Setup(saver => saver.SaveMethodRecording(It.IsAny <MethodRecording>())).Verifiable(); RecordingServices.RecordingSaver = saverMock.Object; RecordingServices.RecordingNamer = new TypeAndMethodNamer(); recorder = (DefaultRecorder)RecordingServices.Recorder; recorder.ClearRecordings(); math = new SimpleMath(); math.Add(5, 5); math.Add(10, 10); SimpleMath.AddStatic(15, 15); }
// = 버튼 누를 시 private void Equals_button_Click(object sender, RoutedEventArgs e) { double temp; if (double.TryParse(result_label.Content.ToString(), out temp)) { switch (selectedOperator) { case SelectedOperator.Addition: result = SimpleMath.Add(lastNumber, temp); break; case SelectedOperator.Substraction: result = SimpleMath.Sub(lastNumber, temp); break; case SelectedOperator.Multiplication: result = SimpleMath.multiply(lastNumber, temp); break; case SelectedOperator.Division: result = SimpleMath.division(lastNumber, temp); break; } result_label.Content = result.ToString(); } }
public static void Main() { SimpleMath sm = new SimpleMath(); // ������ ���� �Ͻ������� ���� sm.mmDelegate += ( (msg, result) => { Console.WriteLine(msg); Console.WriteLine("result : {0}", result); }); // ������ ���� ��������� ���� sm.mmDelegate += ( (string msg, int result) => { Console.WriteLine("2:{0}", msg); Console.WriteLine("2:result : {0}", result); }); // ���� ������ �ٸ� (����!!!) // sm.mmDelegate += ( (string msg) => { // Console.WriteLine("2:{0}", msg); // }); // ���� ������ �Ϻθ� �����(����!!!) // sm.mmDelegate += ( (string msg, result) => { // Console.WriteLine("2:{0}", msg); // Console.WriteLine("2:result : {0}", result); // }); sm.addHook += ( () => { Console.WriteLine("AddWork is hooked!"); }); sm.Add (10, 11); }
private void equalButton_Click(object sender, RoutedEventArgs e) { double newnumber; if (double.TryParse(result.Content.ToString(), out newnumber)) { switch (selectedOperator) { case SelectedOperator.Add: ansresult = SimpleMath.Add(lastnumber, newnumber); result.Content = ansresult; break; case SelectedOperator.Division: ansresult = SimpleMath.Division(lastnumber, newnumber); result.Content = ansresult; break; case SelectedOperator.Multiplication: ansresult = SimpleMath.Multiplication(lastnumber, newnumber); result.Content = ansresult; break; case SelectedOperator.Substract: ansresult = SimpleMath.Substract(lastnumber, newnumber); result.Content = ansresult; break; } } }
//Equl 버튼 클릭 private void EqulButton_Click(object sender, RoutedEventArgs e) { double newNumber; newNumber = double.Parse(resultLabel.Content.ToString()); switch (selectedOperator) { case SelectedOperator.Addition: result = SimpleMath.Add(lastNumber, newNumber); break; case SelectedOperator.Subtraction: result = SimpleMath.Subtract(lastNumber, newNumber); break; case SelectedOperator.Multipleication: result = SimpleMath.Multiple(lastNumber, newNumber); break; case SelectedOperator.Division: result = SimpleMath.Divide(lastNumber, newNumber); break; } resultLabel.Content = result.ToString(); }
public static void Main() { SimpleMath sm = new SimpleMath(); // 인자의 형이 암시적으로 결정 sm.mmDelegate += ((msg, result) => { Console.WriteLine(msg); Console.WriteLine("result : {0}", result); }); // 인자의 형이 명시적으로 지정 sm.mmDelegate += ((string msg, int result) => { Console.WriteLine("2:{0}", msg); Console.WriteLine("2:result : {0}", result); }); // 인자 갯수가 다름 (오류!!!) // sm.mmDelegate += ( (string msg) => { // Console.WriteLine("2:{0}", msg); // }); // 인자 갯수가 일부만 명시적(오류!!!) // sm.mmDelegate += ( (string msg, result) => { // Console.WriteLine("2:{0}", msg); // Console.WriteLine("2:result : {0}", result); // }); sm.addHook += (() => { Console.WriteLine("AddWork is hooked!"); }); sm.Add(10, 11); }
private void EqualBtn_Click(object sender, RoutedEventArgs e) { //double newNumber; if (double.TryParse(resultText.Text, out double newNumber)) { switch (selectedOperator) { case SelectedOperator.Addition: result = SimpleMath.Add(lastNumber, newNumber); break; case SelectedOperator.Substraction: result = SimpleMath.Substract(lastNumber, newNumber); break; case SelectedOperator.Multiplication: result = SimpleMath.Multiply(lastNumber, newNumber); break; case SelectedOperator.Division: result = SimpleMath.Divide(lastNumber, newNumber); break; } resultText.Text = result.ToString(); } }
public void AddTest(int a, int b, int expectedRes) { // Arrange & Act var res = SimpleMath.Add(a, b); Assert.True(expectedRes == res); }
public Response Add(Request request) { var math = new SimpleMath(); var result = math.Add(request.Number1, request.Number2); return(new Response(String.Format("{0} + {1} = {2}", request.Number1, request.Number2, result), request)); }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { // Use the DataRow values to test the Add method double result = num1 + num2; Assert.AreEqual(result, SimpleMath.Add(num1, num2)); }
void button_equal_Click(object sender, RoutedEventArgs e) { double newNumber; if (double.TryParse(label_result.Content.ToString(), out newNumber)) { switch (selectedOperator) { case SelectedOperator.Addition: result = SimpleMath.Add(lastNumber, newNumber); break; case SelectedOperator.Substraction: result = SimpleMath.Substract(lastNumber, newNumber); break; case SelectedOperator.Multiplication: result = SimpleMath.Multiply(lastNumber, newNumber); break; case SelectedOperator.Division: result = SimpleMath.Divide(lastNumber, newNumber); break; } } label_result.Content = result.ToString(); }
public void Add_TwoNumbers_ReturnsSum(double augend, double addend) { // Arrange => Act double sum = SimpleMath.Add(augend, addend); // Assert Assert.AreEqual(augend + addend, sum); }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { double result = num1 + num2; double total = SimpleMath.Add(num1, num2); Assert.AreEqual(result, total); }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { // Use the DataRow values to test the Add method double expectedSum = num1 + num2; // assert with act Assert.AreEqual(expectedSum, SimpleMath.Add(num1, num2)); }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { // Use the DataRow values to test the Add method double expectedValue = num1 + num2; double returnValue = SimpleMath.Add(num1, num2); Assert.AreEqual(expectedValue, returnValue); }
public static void Main(string[] args) { int sum = SimpleMath.Add(5, 7); int product = SimpleMath.Multiply(5, 7); Console.WriteLine("sum = {0}", sum); Console.WriteLine("product = {0}", product); }
static void Main() { SimpleMath simple = new SimpleMath(); int sum = simple.Add(2, 2); Console.WriteLine("2 + 2 = {0}", sum); ComplexMath complex = new ComplexMath(); int square = complex.Square(3); Console.WriteLine("3 squared = {0}", square); }
static void Main(string[] args) { Console.WriteLine("Using MathLib in a console app"); System.Console.WriteLine($"Add: {SimpleMath.Add(5, 3)}"); System.Console.WriteLine($"Subtract: {SimpleMath.Subtract(5, 3)}"); System.Console.WriteLine($"Multiply: {SimpleMath.Multiply(5, 3)}"); System.Console.WriteLine($"Divide: {SimpleMath.Divide(5, 3)}"); System.Console.WriteLine($"Remainder: {SimpleMath.Remainder(5, 3)}"); }
public void SinmpleMathTest() { var calculator = new SimpleMath(); Assert.AreEqual(30, calculator.Add(10, 20)); Assert.AreEqual(-10, calculator.Sub(10, 20)); Assert.AreEqual(10, calculator.AbsSub(10, 20)); }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { // Arrange double expectedResult = num1 + num2; // Act double result = SimpleMath.Add(num1, num2); // Assert Assert.AreEqual(expectedResult, result); }
static void Main() { SimpleMath simple = new SimpleMath(); int sum = simple.Add(2, 2); Console.WriteLine("2 + 2 = {0}", sum); ComplexMath complex = new ComplexMath(); int square = complex.Square(3); Console.WriteLine("3 squared = {0}", square); }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { // Arrange double expectedSum = num1 + num2; // Act double methodSum = SimpleMath.Add(num1, num2); // Assert Assert.AreEqual(expectedSum, methodSum); }
public void AddTest(int firstValue, int secondValue, int expected) { // Arrange SimpleMath math = new SimpleMath(); // Act int actual = math.Add(firstValue, secondValue); // Assert Assert.Equal(expected, actual); }
static void LambdaExpressionsMultipleParams() { SimpleMath m = new SimpleMath(); // register with delegate as lambda expression m.SetMathHandler((msg, result) => { Console.WriteLine("Message: {0}, Result: {1}", msg, result); }); m.zzDelegate += () => { Console.WriteLine("sup homes"); return "sup"; }; // this will trigger the lambda expressions m.Add(10, 10); }
private static void t_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { Console.WriteLine("5 + 2 = {0}", math.Add(5, 2)); Console.WriteLine("5 - 2 = {0}", math.Subtract(5, 2)); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { //Arrange result = num1 + num2; //Act double sum = SimpleMath.Add(num1, num2); //Assert Assert.AreEqual(result, sum); }
public static void Main(string[] args) { int sum = SimpleMath.Add(5, 7); int product = SimpleMath.Multiply(5, 7); //int difference = SimpleMath.Subtraction(5, 7); //int ratio = SimpleMath.Division(15, 5); Console.WriteLine("sum = {0}", sum); Console.WriteLine("product = {0}", product); //Console.WriteLine("difference = {0}", difference); //Console.WriteLine("ratio = {0}", ratio); //Console.ReadLine(); }
public void Add_TwoNumbers_ReturnsSum(double num1, double num2) { // Use the DataRow values to test the Add method // Arrange double expectedTotal = num1 + num2; // Act double returnedTotal = SimpleMath.Add(num1, num2); // Assert Assert.AreEqual(expectedTotal, returnedTotal); }
static void Main() { SimpleMath operation = new SimpleMath(); Console.WriteLine("Give me two numbers and I will add them"); operation.NumSelect(); int result = operation.Add(); Console.WriteLine( "{0} + {1} = {2}", operation.number1, operation.number2, result); }
static void Main(string[] args) { // Create and register the channel. The default channel actor // does not open a port, so we can't use this to receive messages. // HttpChannel channel = new HttpChannel(); //ChannelServices.RegisterChannel(channel); // Get a proxy to the remote object //Object remoteObj = Activator.GetObject(typeof(MathLibrary.SimpleMath), "http://localhost:10000/MyURI.soap"); RemotingConfiguration.Configure("MathClient.exe.config"); // Cast the returned proxy to the SimpleMath type SimpleMath math = new SimpleMath(); // Use the remote object Console.WriteLine("5 + 2 = {0}", math.Add(5, 2)); Console.WriteLine("5-2 = {0}", math.Subtract(5, 2)); // Ask user to press Enter Console.Write("Press enter to end"); Console.ReadLine(); }
public static void Main(string[] args) { int sum = SimpleMath.Add(5, 7); int product = SimpleMath.Multiply(5, 7); int div = SimpleMath.Divide(5, 7); int difference = SimpleMath.Subtract(5, 7); Console.WriteLine("sum = {0}", sum); Console.WriteLine("product = {0}", product); Console.WriteLine("div = {0}", div); Console.WriteLine("difference = {0}", difference); double dsum = SimpleMath.Add(5.0, 7.0); double dproduct = SimpleMath.Multiply(5.0, 7.0); double ddiv = SimpleMath.Divide(5.0, 7.0); double ddifference = SimpleMath.Subtract(5.0, 7.0); Console.WriteLine("dsum = {0}", dsum); Console.WriteLine("dproduct = {0}", dproduct); Console.WriteLine("ddiv = {0}", ddiv); Console.WriteLine("ddifference = {0}", ddifference); }
static void Main(string[] args) { RemotingConfiguration.Configure("../../Client.config"); SimpleMath math = new SimpleMath(); Console.WriteLine("5 + 2 = {0}", math.Add(5, 2)); Console.WriteLine("5 - 2 = {0}", math.Subtract(5, 2)); int[] v = new int[] { 2, 3, 1, 521, 23418, 4321, 152 }; int[] sorted = math.Sort <int>(v); printArray(sorted); Console.WriteLine(math.IndexOf(v, 521)); int[] removedElem = math.RemoveElement(v, 23418); printArray(removedElem); // Ask user to press Enter Console.Write("Press enter to end"); Console.ReadLine(); }