public static Subtract ( int a, int b ) : int | ||
a | int | |
b | int | |
return | int |
//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 Response Subtract(Request request) { var math = new SimpleMath(); var result = math.Subtract(request.Number1, request.Number2); return(new Response(String.Format("{0} - {1} = {2}", request.Number1, request.Number2, result), request)); }
public void Subtract_TwoNumbers_ReturnDifference(double minuend, double subtrahend) { // Arrange => Act double difference = SimpleMath.Subtract(minuend, subtrahend); // Assert Assert.AreEqual(minuend - subtrahend, difference); }
public void Subtract_TwoNumbers_ReturnsSum(double num1, double num2) { double result = num1 - num2; double total = SimpleMath.Subtract(num1, num2); Assert.AreEqual(result, total); }
public void Subtract_TwoValidNumbers_ReturnsSum(double num1, double num2) { // arrange double expectedProduct = num1 - num2; // assert/act Assert.AreEqual(expectedProduct, SimpleMath.Subtract(num1, num2)); }
public void Subtract_TwoNumbers_ReturnsDifference(double num1, double num2) { result = num1 - num2; double difference = SimpleMath.Subtract(num1, num2); Assert.AreEqual(result, difference); }
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 Subtract_TwoValidNumbers_ReturnsDifference(double num1, double num2) { // Arrange double expectedSum = num1 - num2; // Act double methodSum = SimpleMath.Subtract(num1, num2); // Assert Assert.AreEqual(expectedSum, methodSum); }
public void SobtractTest(int firstValue, int secondValue, int expected) { // Arrange SimpleMath math = new SimpleMath(); // Act int actual = math.Subtract(firstValue, secondValue); // Assert Assert.Equal(expected, actual); }
public void Subtract_TwoNumbers_ReturnsDifference(double num1, double num2) { // Arrange double expectedDifference = num1 - num2; // Act double returnedDifference = SimpleMath.Subtract(num1, num2); // Assert Assert.AreEqual(expectedDifference, returnedDifference); }
public void Subtract_TwoValidNumbers_ReturnsSubtractedResult(double num1, double num2) { // Arrange double expectedResult = num1 - num2; // Act double result = SimpleMath.Subtract(num1, num2); // Assert Assert.AreEqual(expectedResult, result); }
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); } }
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(); }
public void Subtract_TwoValidNumbersPositveAndNegitive_ReturnDifference(double num1, double num2) { double expectedValue = num1 - num2; Assert.AreEqual(expectedValue, SimpleMath.Subtract(num1, num2)); }
public void SubtractTest(int a, int b, int expectedRes) { var res = SimpleMath.Subtract(a, b); Assert.True(expectedRes == res); }
public void SubtractTest() { var res = SimpleMath.Subtract(10, 3); Assert.True(7 == res); }
public void Subtract_TwoValidNumbers(double num1, double num2) { double result = num1 - num2; Assert.AreEqual(result, SimpleMath.Subtract(num1, num2)); }
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"); // Cast the returned proxy to the SimpleMath type RemotingConfiguration.RegisterActivatedClientType(typeof(MathLibrary.SimpleMath), "http://localhost:10000"); SimpleMath math = new SimpleMath("Client-Activated"); // Use the remote object Console.WriteLine("5 + 2 = {0}", math.Add(5, 2)); Console.WriteLine("5 - 2 = {0}", math.Subtract(5, 2)); //******************** TEMA **************** //***************** Citire vector ****************** int n; do { Console.Write("Dimensiune:"); n = Int32.Parse(Console.ReadLine()); }while (n < 1); string[] answer = new string[n]; for (int i = 0; i < answer.Length; i++) { Console.Write("v[{0}]:", i); answer[i] = Console.ReadLine(); } //***************** Sortare vector ****************** string[] sortedVector = math.Sort(answer, n); Console.WriteLine("Vectorul sortat:"); foreach (string v in sortedVector) { Console.Write(v + " "); } Console.Write("\n"); //***************** Cautare element ****************** Console.Write("Valoarea cautata:"); string cauta = Console.ReadLine(); if (math.Search(answer, answer.Length, cauta) != -1) { Console.WriteLine(" Valoarea {0} se afla in vector", cauta); } else { Console.WriteLine(" Valoarea {0} nu se afla in vector", cauta); } //*************** Șterge valoare ************ Console.Write("introduceti valoarea pe care doriti sa o stergeti:"); string sters = Console.ReadLine(); if (math.Search(answer, answer.Length, sters) == -1) { Console.Write("Valoarea {0} nu se gaseste in vector"); } else { string[] vectorPrelucrat = math.Delete(answer, sters); Console.Write("Noul vector:"); foreach (string s in vectorPrelucrat) { Console.Write("{0} ", s); } Console.Write("Lungime vector: " + vectorPrelucrat.Length); } Console.Write("\n"); // Ask user to press Enter Console.Write("Press enter to end"); Console.ReadLine(); }