Ejemplo n.º 1
0
        public void TestExportEmpty()
        {
            var stream   = new MemoryStream();
            var logFile  = new InMemoryLogSource();
            var exporter = new LogFileToStreamExporter(logFile, stream);

            new Action(() => exporter.Export()).Should().NotThrow();
            GetString(stream).Should().Be(string.Empty, "because an empty log file should result in an empty export");
        }
Ejemplo n.º 2
0
        public void TestExportOneLine()
        {
            var stream  = new MemoryStream();
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("Hello, World!", LevelFlags.Other);
            var exporter = new LogFileToStreamExporter(logFile, stream);

            new Action(() => exporter.Export()).Should().NotThrow();

            GetString(stream).Should().Be("Hello, World!");
        }
        public void TestTwoLines()
        {
            var stream  = new MemoryStream();
            var logFile = new InMemoryLogFile();

            logFile.AddEntry("Hello,", LevelFlags.None);
            logFile.AddEntry("World!", LevelFlags.None);
            var exporter = new LogFileToStreamExporter(logFile, stream);

            new Action(() => exporter.Export()).ShouldNotThrow();

            GetString(stream).Should().Be("Hello,\r\nWorld!");
        }