示例#1
0
 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());
     }
 }
示例#2
0
 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");
 }
示例#3
0
 private void Sum_Click(object sender, EventArgs e)
 {
     cal.getInput(one.Text, two.Text, operatorLabel.Text, new Logging("WindowForm"));
     answer.Text = cal.calculate();
 }