-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathProgram.cs
More file actions
33 lines (31 loc) · 1.07 KB
/
Program.cs
File metadata and controls
33 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.Text;
using StringCalculator.Logic;
namespace StringCalculator.Test
{
class Program
{
static void Main(string[] args)
{
string[] tests = {"","1","1,2","1,2,3","1,2,3,4","1\n2,3","//;\n1;2","-1,2,-5", "1001,2","//[***]\n1***2***3","//[*][%]\n1*2%3", "//[^^][*]\n1^^2*3"};
foreach (string test in tests)
{
Console.WriteLine(String.Format("Test: {0}", test));
try
{
Console.WriteLine(string.Format("Result: {0}", new Calculator().Sum(test)));
}
catch (NegativesNotAllowedException ex)
{
Console.WriteLine("Controlled Exception:");
Console.WriteLine(ex.Message);
Console.WriteLine(ex.Negatives);
}
Console.WriteLine("-------------");
}
Console.WriteLine("Test Ended. Press Enter to continue.");
Console.Read();
}
}
}