示例#1
0
        static void Main(string[] args)
        {
            InitializeIoC();

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    Console.WriteLine("Enter input:"); // Prompt
                    string input = Console.ReadLine(); // Get string from user

                    _IStringIntegerCalculator = Res365Container.Instance.Resolve <IStringIntegerCalculator>();

                    int result = _IStringIntegerCalculator.CalculatorString(input, upBound: 2000, allowNegative: true);

                    Console.WriteLine($"Fomural: {_IStringIntegerCalculator.Formular}");
                    Console.WriteLine($"Result: {result}");
                }
            });
            Console.CancelKeyPress += new ConsoleCancelEventHandler(OnExit);
            _closing.WaitOne();
        }
        public void Fomular_Test()
        {
            string input  = "2,4,rrrr,1001,6";
            string result = "2+4+0+0+6 = 12";

            _StringIntegerCalculator.CalculatorString(input);
            Assert.IsTrue(_StringIntegerCalculator.Formular == result);
        }