예제 #1
0
        void DoTest(string formatDescription, string testLog, params EM[] expectedMessages)
        {
            ExpectedLog expectedLog = new ExpectedLog();

            expectedLog.Add(0, expectedMessages);
            ReaderIntegrationTest.Test(CreateFactory(formatDescription), testLog, expectedLog);
        }
예제 #2
0
 public static void Test(IMediaBasedReaderFactory factory, string testLog, ExpectedLog expectation, Encoding encoding)
 {
     using (StringStreamMedia media = new StringStreamMedia(testLog, encoding))
     {
         Test(factory, media, expectation);
     }
 }
예제 #3
0
        void DoTest(string testLog, params ExpectedMessage[] expectedMessages)
        {
            ExpectedLog expectedLog = new ExpectedLog();

            expectedLog.Add(0, expectedMessages);
            DoTest(testLog, expectedLog);
        }
예제 #4
0
        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();
                }
        }
예제 #5
0
        async Task DoTest(string testLog, params ExpectedMessage[] expectedMessages)
        {
            ExpectedLog expectedLog = new ExpectedLog();

            expectedLog.Add(0, expectedMessages);
            await DoTest(testLog, expectedLog);
        }
        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();
                }
        }
예제 #7
0
 void DoTest(string testLog, ExpectedLog expectedLog)
 {
     ReaderIntegrationTest.Test(CreateFactory(), testLog, expectedLog);
 }
예제 #8
0
        public static void Test(IMediaBasedReaderFactory factory, System.IO.Stream testLogStream, ExpectedLog expectation)
        {
            using (StringStreamMedia media = new StringStreamMedia())
            {
                media.SetData(testLogStream);

                Test(factory, media, expectation);
            }
        }
예제 #9
0
 public static void Test(IMediaBasedReaderFactory factory, string testLog, ExpectedLog expectation)
 {
     Test(factory, testLog, expectation, Encoding.ASCII);
 }
예제 #10
0
 async Task DoTest(string testLog, ExpectedLog expectedLog)
 {
     await ReaderIntegrationTest.Test(CreateFactory(), testLog, expectedLog);
 }
예제 #11
0
 public static async Task Test(IMediaBasedReaderFactory factory, string testLog, ExpectedLog expectation)
 {
     await Test(factory, testLog, expectation, Encoding.ASCII);
 }
예제 #12
0
        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();
                }
        }