Beispiel #1
0
        static void Main(string[] args)
        {
            Program program = new Program();

            while (program._running)
            {
                var kernel = MainModule.CreateKernel();
                _primeNumberGeneratorEngine = kernel.Get <IPrimeNumberGeneratorEngine>();
                _stringReverseEngine        = kernel.Get <IStringReverseEngine>();
                _logger = kernel.Get <ILogger>();
                _logger.Log(LogLevel.Info, "\n\n\nType P and hit enter to run prime number generator Algorithm");
                _logger.Log(LogLevel.Info, "\n Type R and hit enter to run string reverse Algorithm");
                _logger.Log(LogLevel.Info, "\n Type Q and hit enter to exit");
                string command;
                command = Console.ReadLine();
                switch (command)
                {
                case "P":
                    GeneratePrime();
                    break;

                case "R":
                    StringReverse();
                    break;

                case "Q":
                    program._running = false;
                    break;

                default:
                    _logger.Log(LogLevel.Error, "Unknown Command " + command);
                    break;
                }
            }
        }
Beispiel #2
0
        public static void ClassInitialize(TestContext context)
        {
            var kernel     = new StandardKernel();
            var mockLogger = new Mock <ILogger>();

            kernel.Unbind <ILogger>();
            kernel.Bind <ILogger>().ToConstant(mockLogger.Object);
            kernel.Load <EngineModule>();
            mockLogger.Setup(x => x.Log(It.IsAny <LogLevel>(), It.IsAny <string>(), It.IsAny <Exception>()));
            engine = kernel.Get <IPrimeNumberGeneratorEngine>();
        }