public static void Test(IMediaBasedReaderFactory factory, string testLog, ExpectedLog expectation, Encoding encoding) { using (StringStreamMedia media = new StringStreamMedia(testLog, encoding)) { Test(factory, media, expectation); } }
public static void Test(IMediaBasedReaderFactory factory, ILogMedia media, ExpectedLog expectation) { using (ILogSourceThreadsInternal threads = new LogSourceThreads()) using (IPositionedMessagesReader reader = factory.CreateMessagesReader(new MediaBasedReaderParams(threads, media, tempFilesManager, new TraceSourceFactory()))) { reader.UpdateAvailableBounds(false); List <IMessage> msgs = new List <IMessage>(); using (var parser = reader.CreateParser(new CreateParserParams(reader.BeginPosition))) { for (; ;) { var msg = parser.ReadNext(); if (msg == null) { break; } msgs.Add(msg); } } expectation.StartVerification(); for (int i = 0; i < msgs.Count; ++i) { expectation.Verify(i, msgs[i]); } expectation.FinishVerification(); } }
public static async Task Test(IMediaBasedReaderFactory factory, ILogMedia media, ExpectedLog expectation) { using (ILogSourceThreadsInternal threads = new LogSourceThreads()) using (IPositionedMessagesReader reader = factory.CreateMessagesReader(new MediaBasedReaderParams(threads, media))) { await reader.UpdateAvailableBounds(false); List <IMessage> msgs = new List <IMessage>(); await DisposableAsync.Using(await reader.CreateParser(new CreateParserParams(reader.BeginPosition)), async parser => { for (; ;) { var msg = await parser.ReadNext(); if (msg == null) { break; } msgs.Add(msg); } }); expectation.StartVerification(); for (int i = 0; i < msgs.Count; ++i) { expectation.Verify(i, msgs[i]); } expectation.FinishVerification(); } }
public static void Test(IMediaBasedReaderFactory factory, System.IO.Stream testLogStream, ExpectedLog expectation) { using (StringStreamMedia media = new StringStreamMedia()) { media.SetData(testLogStream); Test(factory, media, expectation); } }
public static void Test(IMediaBasedReaderFactory factory, ILogMedia media, ExpectedLog expectation) { using (ILogSourceThreads threads = new LogSourceThreads()) using (IPositionedMessagesReader reader = factory.CreateMessagesReader(new MediaBasedReaderParams(threads, media, tempFilesManager))) { reader.UpdateAvailableBounds(false); List <IMessage> msgs = new List <IMessage>(); using (var parser = reader.CreateParser(new CreateParserParams(reader.BeginPosition))) { for (; ;) { var msg = parser.ReadNext(); if (msg == null) { break; } msgs.Add(msg); } } expectation.StartVerification(); int frameLevel = 0; for (int i = 0; i < msgs.Count; ++i) { switch (msgs[i].Flags & MessageFlag.TypeMask) { case MessageFlag.StartFrame: ++frameLevel; break; case MessageFlag.EndFrame: --frameLevel; break; } expectation.Verify(i, msgs[i], frameLevel); } expectation.FinishVerification(); } }
public static void Test(IMediaBasedReaderFactory factory, string testLog, ExpectedLog expectation) { Test(factory, testLog, expectation, Encoding.ASCII); }
public static async Task Test(IMediaBasedReaderFactory factory, string testLog, ExpectedLog expectation) { await Test(factory, testLog, expectation, Encoding.ASCII); }