Exemplo n.º 1
0
        public void CheckGenerateReportWithMultipleSectionsAndEntries()
        {
            const string k_ExpectedOutput = @"==== Section One ====
Entry Header: Entry Body
Entry Header 2: Entry Body 2
Entry Header 3: Entry Body 3

==== Section Two ====
Entry Header 4: Entry Body 4
Entry Header 5: Entry Body 5
Entry Header 6: Entry Body 6

==== Last 20 Events ====
";

            var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle);

            DiagnosticReport.AddSectionEntry(sectionOneHandle, "Entry Header", "Entry Body");
            DiagnosticReport.AddSectionEntry(sectionOneHandle, "Entry Header 2", "Entry Body 2");
            DiagnosticReport.AddSectionEntry(sectionOneHandle, "Entry Header 3", "Entry Body 3");

            var sectionTwoHandle = DiagnosticReport.GetSection(k_SectionTwoTitle);

            DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Entry Header 4", "Entry Body 4");
            DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Entry Header 5", "Entry Body 5");
            DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Entry Header 6", "Entry Body 6");

            var report = DiagnosticReport.GenerateReport();

            Assert.AreEqual(k_ExpectedOutput, report);
        }
Exemplo n.º 2
0
        public void CheckFullReport()
        {
            const string k_ExpectedOutput = @"==== Section One ====
Section One Entry One: Simple

==== Section Two ====
Section Two Entry One: Simple

Section Two Entry Two: (2)
    FOO=BAR
    BAZ=100

==== Last 20 Events ====
Event 11: Event Body 11
Event 12: Event Body 12
Event 13: Event Body 13
Event 14: Event Body 14
Event 15: Event Body 15
Event 16: Event Body 16
Event 17: Event Body 17
Event 18: Event Body 18
Event 19: Event Body 19
Event 20: Event Body 20
Event 21: Event Body 21
Event 22: Event Body 22
Event 23: Event Body 23
Event 24: Event Body 24
Event 25: Event Body 25
Event 26: Event Body 26
Event 27: Event Body 27
Event 28: Event Body 28
Event 29: Event Body 29
Event 30: Event Body 30
";

            var sectionOneHandle = DiagnosticReport.GetSection(k_SectionOneTitle);

            DiagnosticReport.AddSectionEntry(sectionOneHandle, "Section One Entry One", "Simple");

            for (int i = 0; i <= 30; i++)
            {
                DiagnosticReport.AddEventEntry($"Event {i}", $"Event Body {i}");
            }

            var sectionTwoHandle = DiagnosticReport.GetSection(k_SectionTwoTitle);

            DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Section Two Entry One", "Simple");
            DiagnosticReport.AddSectionBreak(sectionTwoHandle);
            DiagnosticReport.AddSectionEntry(sectionTwoHandle, "Section Two Entry Two", @"(2)
    FOO=BAR
    BAZ=100
");

            var report = DiagnosticReport.GenerateReport();

            Debug.Log(report);
            Assert.AreEqual(k_ExpectedOutput, report);
        }