Пример #1
0
        public void TestCancel(Guid[] guids, int delay, IEnumerable <string> traceOutput)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                TextWriterTraceListener listener = new TextWriterTraceListener(stream);
                Trace.Listeners.Add(listener);

                _tcpClient.RunTests(guids, out int testRunID);
                Thread.Sleep(delay);
                _tcpClient.CancelTestRun();

                Thread.Sleep(2000);
                Trace.Flush();

                stream.Position = 0;
                using (StreamReader reader = new StreamReader(stream))
                {
                    foreach (string trace in traceOutput)
                    {
                        Assert.AreEqual(trace, reader.ReadLine());
                    }
                }
            }
        }