示例#1
0
        public Config(bool daemon = false)
        {
            Daemon    = daemon;
            Root      = ExecutableTools.Relative(@"Root");
            WebRoot   = PathTools.Combine(Root, "Web");
            WebIP     = "127.0.0.1";
            WebPort   = 12334;
            ShellRoot = PathTools.Combine(Root, "Test_{0}", TimeTools.Compact(DateTime.Now));
            ShellIP   = "127.0.0.1";
            ShellPort = 12333;

            Directory.CreateDirectory(WebRoot);
            Directory.CreateDirectory(ShellRoot);

            var writers = new WriteLineCollection();

            writers.Add(new StdoutWriteLine());
            var logfile = PathTools.Combine(Root, "log.txt");

            log = new StreamWriter(logfile, true);
            writers.Add(new TextWriterWriteLine(log));
            Timed        = new TimedWriter(writers);
            Logger.TRACE = Timed;
            writers.WriteLine(string.Empty); //separating line
            writers.WriteLine("");
            Logger.Trace("-----------------------------------------------------------------------------");
            Logger.Trace("Test case {0} starting...", TestContext.CurrentContext.Test.FullName);
            //System.InvalidOperationException : This property has already been set and cannot be modified.
            //Thread.CurrentThread.Name = "NUnit";
        }
示例#2
0
文件: Engine.cs 项目: vesy53/SoftUni
 public Engine(
     IRead read,
     IWriter writer,
     IWriteLine writeLine)
 {
     this.read      = read;
     this.writer    = writer;
     this.writeLine = writeLine;
 }
        public static void LogArgs(IWriteLine writer, string[] args, Action <string> callback = null)
        {
            writer?.WriteLine("Cmd {0}", Location());
            writer?.WriteLine("Args {0} {1}", args.Length, string.Join(" ", args));

            for (var i = 0; i < args.Length; i++)
            {
                var arg = args[i];
                writer?.WriteLine("Arg {0} {1}", i, arg);
                callback?.Invoke(arg);
            }
        }
示例#4
0
        public ShellStream(IWriteLine writer, IReadLine reader)
        {
            var thread = Thread.CurrentThread.Name;

            this.writer = writer;
            this.reader = reader;
            runner      = new Runner(new Runner.Args()
            {
                ThreadName = string.Format("{0}_SHELL_R", thread)
            });
            runner.Run(ReadLoop);
            runner.Run(AfterLoop);
        }
示例#5
0
 public void Add(IWriteLine writer) => writers.Add(writer);