public static void CreateNew(IArguments arguments) { // Validate the mandatory input params if (!arguments.ContainsKey("type")) { throw new ArgumentException("-type not provided"); } if (!arguments.ContainsKey("port")) { throw new ArgumentException("-port not provided"); } if (!arguments.ContainsKey("host")) { throw new ArgumentException("-host not provided"); } if (!arguments.ContainsKey("username")) { throw new ArgumentException("-username not provided"); } if (!arguments.ContainsKey("password")) { throw new ArgumentException("-password not provided"); } if (_current == null) { _current = new UnitTestContext(arguments); } }
public static void CreateNew(IArguments arguments) { // Validate the mandatory input params if (!arguments.ContainsKey("type")) throw new ArgumentException("-type not provided"); if (!arguments.ContainsKey("port")) throw new ArgumentException("-port not provided"); if (!arguments.ContainsKey("host")) throw new ArgumentException("-host not provided"); if (!arguments.ContainsKey("username")) throw new ArgumentException("-username not provided"); if (!arguments.ContainsKey("password")) throw new ArgumentException("-password not provided"); if (_current == null) _current = new UnitTestContext(arguments); }
private UnitTestContext(IArguments arguments) { if (arguments == null) throw new InvalidOperationException( "Current Context could not be initialized. No arguments passed to the context"); var element = new LogElement { Parameters = "-ShowOnConsole:true ", ProviderType = "KonfDB.Infrastructure.Logging.Logger, KonfDBC" }; if (arguments.ContainsKey("runtime-logConfigPath")) element.Parameters += "-path:" + arguments["runtime-logConfigPath"]; var logger = LogFactory.CreateInstance(element); CurrentContext.CreateDefault(logger, arguments, null); }
public Logger(IArguments args) : base(args) { if (args.ContainsKey("logConfigPath") && File.Exists(args["logConfigPath"])) { XmlConfigurator.Configure(new FileInfo(args["logConfigPath"])); _log = LogManager.GetLogger("KonfDB"); } else { _log = LogManager.GetLogger("KonfDB"); var appenders = new List<IAppender> {CreateFileAppender("FileAppender", @"Logs\KonfDB.log")}; if (args.GetValue("ShowOnConsole", "false") .Equals(bool.TrueString, StringComparison.InvariantCultureIgnoreCase)) appenders.Add(CreateConsoleAppender()); BasicConfigurator.Configure(appenders.ToArray()); } }
private UnitTestContext(IArguments arguments) { if (arguments == null) { throw new InvalidOperationException( "Current Context could not be initialized. No arguments passed to the context"); } var element = new LogElement { Parameters = "-ShowOnConsole:true ", ProviderType = "KonfDB.Infrastructure.Logging.Logger, KonfDBC" }; if (arguments.ContainsKey("runtime-logConfigPath")) { element.Parameters += "-path:" + arguments["runtime-logConfigPath"]; } var logger = LogFactory.CreateInstance(element); CurrentContext.CreateDefault(logger, arguments, null); }
public Logger(IArguments args) : base(args) { if (args.ContainsKey("logConfigPath") && File.Exists(args["logConfigPath"])) { XmlConfigurator.Configure(new FileInfo(args["logConfigPath"])); _log = LogManager.GetLogger("KonfDB"); } else { _log = LogManager.GetLogger("KonfDB"); var appenders = new List <IAppender> { CreateFileAppender("FileAppender", @"Logs\KonfDB.log") }; if (args.GetValue("ShowOnConsole", "false") .Equals(bool.TrueString, StringComparison.InvariantCultureIgnoreCase)) { appenders.Add(CreateConsoleAppender()); } BasicConfigurator.Configure(appenders.ToArray()); } }
public bool HasArgument(string key) { return(Args.ContainsKey(key)); }