public void TestMethod1() { string a = "10", b = "20"; Calculator cal = new Calculator(); string[] operatorSet = { "+", "-", "*", "/" }; string[] sum = { "30", "-10", "200", "0.5" }; for (int i = 1; i < 4; i++) { cal.getInput(a, b, operatorSet[i], null); Assert.AreEqual(sum[i], cal.calculate()); } }
static void Main(string[] args) { Calculator cal = new Calculator(); if (args.Length == 3) { AttachConsole(ATTACH_PARENT_PROCESS); cal.getInput(args[1], args[2], args[0],new Logging("Console")); System.Console.WriteLine(cal.calculate()); } else if (args.Length == 0) { System.Diagnostics.Process.Start(@"" + Path.GetFullPath(".") + "WindowsFormsApplication1.exe"); System.Console.WriteLine("This is WindowForm"); } else System.Console.WriteLine("It's not match with pattern : -operater and 2 input"); }
private void Sum_Click(object sender, EventArgs e) { cal.getInput(one.Text, two.Text, operatorLabel.Text, new Logging("WindowForm")); answer.Text = cal.calculate(); }