예제 #1
0
        public void WriteCsvLineTest()
        {
            var rsg  = new RandomStringGenerator(true, true, true, true);
            var file = "";

            using (
                var writer = new SimpleLogger.RollingFlatFileTraceListener(
                    "trace.log",
                    null,
                    null,
                    512,
                    "HHmmss",
                    "yyyyMMdd",
                    SimpleLogger.RollFileExistsBehavior.Increment,
                    SimpleLogger.RollInterval.Day))
            {
                file = writer.Name;
                foreach (var i in Enumerable.Range(1, 3))
                {
                    writer.WriteCsvLine(Enumerable.Range(1, 8).Select(x => rsg.Generate(3, 6)).ToArray());
                }
                foreach (var i in Enumerable.Range(1, 3))
                {
                    writer.WriteCsvLine(
                        Enumerable.Range(1, 8)
                        .Select(x => rsg.Generate(2) + Environment.NewLine + rsg.Generate(1, 2))
                        .ToArray());
                }
                writer.Flush();
            }

            if (File.Exists(file))
            {
            }
            else
            {
                Assert.Fail();
            }
        }